String?
- Posted by Rolf Schröder <rolf at rschr.de> May 31, 2004
- 720 views
Hi 'string fans'! As I know, a character is a byte that represents a human readable or printable symbol. A character string (synonymous: string) is a series of characters. i.e., a series of bytes representing human readable|printable symbols (words, sentences,...). Is it important to differentiate between a general byte series (#00 to #FF) and a 'string'? 1) If there are 256 readable|printable symbols assigned to the numbers #00 to #FF, then it's impossible do decide, if you have a 'string' or not! 2) If you declare at least one byte not to be a readable|printable symbol, then you may declare any byte series of this type as a 'string' in comparison to a generally byte series, which may contain any byte between #00 and #FF. In C, i.e., #00 is assumed to be such a byte, and therefore a byte series ending with the byte #00 is declared as such a type of string (Null terminated string). This makes sense only for specially written 'string handling routines' (stringcmp(), printf(),...), nothing else. 3) For I know what I would like to read|write|print, Euphoria gives you the opportunity to decide, what you would like to handle as a 'string' or not. In practice I don't see any necessity to have a so called string type, it makes no real sense. However, if you believe you need it, then use a type function similar like that, what Nicholas Koceja has given as an example. Do you really think a sting type makes sense in Euphoria? I don't! -- ---------------------------------------------------- | Dr.Rolf Schröder | E B | | Möörkenweg 37 | C | | 21029 Hamburg | D | | Deutschland | A | | Earth |-------------------------------| | Solar System | Earth Phone : +49-40-724-4650 | | Milky Way | National Fax: 0721-151-577722 | | Local Group | mailto:Rolf at RSchr.de | | Known Universe | http://www.rschr.de | ----------------------------------------------------