Sather Home Page

Section 8.17.3.1:
STR

class STR < $TEXT_STRING{CHAR,FSTR,STR}, $REFERENCE, $STR, $ANCHORED_FMT is -- This class provides a string implementation in which each character -- has a single encoding. The strings are provided with immutable semantics. -- Any literal strings used in the program text are of this class. readonly attr width : CARD ; -- the width as determined from OS create( sz : CARD, lib : LIBCHARS ) : SAME is -- This routine is the 'general' creation one which is called by all of -- the others in which the size is expected to be the number of character -- codes! create( lib : LIBCHARS ) : SAME is -- This routine returns an empty character string. create( sz : CARD ) : SAME is -- This routine is the version of creation which assumes the default -- cultural repertoire and environment. create : SAME is -- This routine returns an empty character string. create( ch : CHAR, lib : LIBCHARS ) : SAME is -- This routine creates and then returns a single element character -- string. create( rns : RUNES ) : SAME -- This routine attempts to create a new character string from the given -- rune string, using the same repertoire and encoding - provided that there -- are no combining codes detected during creation. In this case void is -- returned. create_from_external_string( str_ref : REFERENCE, lib : LIBCHARS ) : SAME -- This routine creates a new string in the default repertoire and -- encoding from the external string indicated by str_ref. create_from_external_string( str_ref : REFERENCE ) : SAME -- This routine creates a new string in the default repertoire and -- encoding from the external string indicated by str_ref. from_fstr( fstr : FSTR ) : SAME -- This routine converts the given fast character string into the normal -- string form (which has immutable semantics). cursor : STR_CURSOR -- This routine returns a cursor object corresponding to the contents of -- self. ???? aget/aset??? char( index : CARD ) : CHAR -- This routine returns the value of the character at the given index. -- It is a synonym for aget. convert( lib : LIBCHARS ) : SAME -- This routine converts self to be in the given encoding and -- repertoire. If any character has no corresponding code then void is -- returned. default_lib : SAME -- This routine returns self (which must either be a literal - with -- invalid value (CARD::maxval) - produced by the compiler OR already -- a string with the default repertoire and encoding!), using the same -- bit-pattern and setting the default library. split!( once ch : CHAR ) : SAME -- This iter yields successive substrings of self which are separated -- by the single character. The separating characters are omitted and the -- string yielded starts after the previous separating character up to and -- NOT including the next (or the end of self if not found). separate!( str : SAME ) : SAME -- On the first iteration just outputs str, on successive iterations it -- outputs self followed by str. Useful for forming lists, eg pretty : STR -- This routine returns a copy of self surrounded by quotation marks -- in which all control codes are replaced by an octal string preceded by -- an escape character. This escape character is conventionally a reverse -- solidus. Should a quotation mark occur in the string this is also -- replaced by an octal string preceded by the escape character. as_literal : STR -- This routine returns a string to the form it would have had before -- applying pretty to it. Thus -- -- str = str.pretty.as_literal -- -- If self is not in correct string literal format then void is returned.

This page has not yet been written.


Language Index Library Index Text Index
Comments or enquiries should be made to Keith Hopper.
Page last modified: Monday, 22 May 2000.
Produced with Amaya