class STR < $IS_LT{STR},$HASH,$STR,$ELT{CHAR},$FMT |
---|
**** | Strings are represented as arrays of characters. Every character is significant.
_ References: Gonnet and Baeza-Yates, "Handbook of Algorithms and Data Structures", Addison Wesley, 1991. Make modification routines private. |
$FMT | $ELT{_} | $ELT | $STR | $HASH | $IS_EQ | $IS_LT{_} | AREF{_} |
acopyn(s:FSTR,n:INT) |
---|
**** | copy "n" chars from "s" into "self". Built-in. |
acopyn(s:STR,n:INT) |
---|
**** | copy "n" chars from "s" into "self". Built-in. |
aget(ind:INT):T .. Included as aget |
---|
**** | The element of self with index `ind'. Built-in. |
append(s:SAME):SAME |
---|
**** | A new string obtained by appending `s' to self. Either self or `s' may be void. |
append(s1,s2:SAME):SAME |
---|
**** | A new string obtained by appending args to self. Any of the strings may be void. |
append(s1,s2,s3:SAME):SAME |
---|
**** | A new string obtained by appending args to self. Any of the strings may be void. |
append(s1,s2,s3,s4:SAME):SAME |
---|
**** | A new string obtained by appending args to self. Any of the strings may be void. |
append(s1,s2,s3,s4,s5:SAME):SAME |
---|
**** | A new string obtained by appending args to self. Any of the strings may be void. |
append(s1,s2,s3,s4,s5,s6:SAME):SAME |
---|
**** | A new string obtained by appending args to self. Any of the strings may be void. |
append_destroy(s:SAME, destroy:BOOL):SAME |
---|
**** | appends s to self and destroys s if possible |
as_literal:STR |
---|
**** | Returns the string described by self assuming it is in "string literal" form. This means it must begin and end with double quotes and must not contain any non-printing characters. The returned string eliminates the initial and final double quotes and converts any escape codes to the corresponding characters. self may consist of several double-quote enclosed strings separated by whitespace. In this case the strings are concatenated together. If self is not in correct string literal format, returns void. |
capitalize:SAME |
---|
**** | A copy of self with each word capitalized. Self may be void. |
center(i:INT): SAME |
---|
center(i:INT,fill:CHAR):SAME |
---|
**** | A string of at least `i' characters in which self is centered and padded with spaces on the left and right. Returns self if i<=size. |
char(i:INT):CHAR |
---|
**** | The character at index `i' of self. |
concat_all(a: ARRAY{SAME}): SAME |
---|
**** | Concatinate all array of STRING. Separator is '\0'. |
contains(c:CHAR):BOOL |
---|
**** | True if `c' appears in self. Self may be void. |
contains_chars_from(s:STR):BOOL |
---|
**** | True if any of the characters in self are contained in `s'. Either may be void. |
count(c:CHAR):INT |
---|
**** | The number of times `c' appears in self. Self may be void. |
count(s:STR):INT |
---|
**** | The number of times a character in `s' appears in self. Self may be void. |
count_chars_from(s:SAME):INT |
---|
**** | The number of characters in self which are contained in `s'. Either may be void. |
create(c:CHAR):SAME |
---|
**** | String containing the single character 'c'. |
create:SAME |
---|
**** | An empty string. (Occasionally useful in constructs like `#STR + foo'). |
create_from_c_string(s:EXT_OB):SAME |
---|
**** | Create a Sather string from a C pointer. Needless to say, use this with caution. |
create_from_file(nm:STR):SAME |
---|
**** | Open the file named `nm' in the current directory, create a string containing its contents and then close the file. Return void if there is no such file. |
create_from_file_range(nm:STR,st,sz:INT):SAME |
---|
**** | Open the file named `nm' in the current directory, create a string containing `sz' characters starting at `st'. Fill in the remainder with '\0' if the file is too small. Return void if there is no such file. |
create_from_memory_area(s:EXT_OB,len:INT):SAME |
---|
**** | Create a Sather string from a memory area of size 'len' bytes starting at 's'. Needless to say, use this with caution. |
cursor: STR_CURSOR |
---|
escape(esc:CHAR, elist:SAME):SAME |
---|
**** | return self w/ each occurance of esc & of all chars in elist preceded by esc (Rob) |
fmt( f: STR ): STR |
---|
from_fstr(s:FSTR):SAME |
---|
**** | A new string with the characters currently held in `s'. Returns empty string if emtpy. Modified MBK. |
fstr:FSTR |
---|
**** | An FSTR with the same characters as self.
______if_size=0_then_return_void;_end; ______r::=#FSTR(size); ______loop_r:=r.push(elt!);_end; ______return_r; ______end; |
hash:INT |
---|
head(i:INT):SAME |
---|
**** | The first `i' characters of self. Self may be void if i=0. |
is_empty:BOOL |
---|
**** | True if self has no characters. Self may be void. |
is_eq(s:SAME):BOOL |
---|
**** | True if `s' equals self. Either may be void. |
is_eq(arg: $OB): BOOL .. Included as is_eq |
---|
is_leq(s:SAME):BOOL |
---|
**** | True if self is lexicographically before `s' or equal to it. Either may be void. |
is_lower:BOOL |
---|
**** | True if each alphabetic character of self is lower case. Self may be void. |
is_lt(s:SAME):BOOL |
---|
**** | True if self is lexicographically before `s'. Void is taken to be before everything else. |
is_prefix(s:SAME):BOOL |
---|
**** | true is s is a prefix of self. |
is_upper:BOOL |
---|
**** | True if each alphabetic character of self is upper case. Self may be void. |
left(i:INT): SAME |
---|
left(i:INT,fill:CHAR):SAME |
---|
**** | A string of at least `i' characters in which self is left-justified and padded with spaces on the right. Returns self if i<=size. |
length:INT |
---|
**** | The number of characters in self. 0 if self is void. Another name for `size'. |
lower:SAME |
---|
**** | A copy of self with each character in lower case. Self may be void. |
minus(s:SAME):SAME |
---|
**** | return self with the first instance of s deleted if any (Rob) |
minus(s:SAME,start:INT):SAME |
---|
**** | return self with the first instance of s after start deleted if any |
mismatch(s:SAME):INT |
---|
**** | The index of the first character of self which differs from `s'. -1 if self is a prefix of `s'. Either may be void. |
plus(arg:CHAR):SAME |
---|
plus(sarg:FSTR):SAME |
---|
plus(arg:INT):SAME |
---|
plus(sarg:STR):SAME |
---|
plus(sarg:$STR):SAME |
---|
**** | A new string obtained by appending `sarg' to self. Either self or `s' may be void. Sped up, MBK et al. |
pretty:STR |
---|
**** | Pretty print self. This surrounds the string with a pair of double quotes. Any non-printing characters or double quotes are replaced by their special codes or the octal representation. |
remove(c:CHAR):SAME |
---|
**** | Self with all occurances of `c' removed. Self may be void. |
remove_chars_from(s:SAME):SAME |
---|
**** | Self with all characters which are contained in `s' removed. Either may be void. |
repeat(i:INT):SAME |
---|
**** | Self repeated `i' times. Self may be void. |
replace(o,n:CHAR):SAME |
---|
**** | A new string with each occurance of `o' replaced by `n'. Self may be void. |
replace_chars_from(set:SAME,n:CHAR):SAME |
---|
**** | A new string with character contained in `set' replaced by `n'. Self may be void. |
replace_suffix(old,rpl:SAME):SAME |
---|
reverse:SAME |
---|
**** | A string whose characters are the reverse of those in self. Self may be void. |
right(i:INT): SAME |
---|
right(i:INT,fill:CHAR):SAME |
---|
**** | A string of at least `i' characters in which self is right-justified and padded with spaces on the left. Returns self if i<=size. |
search(c:CHAR):INT |
---|
**** | The index of the first appearance of `c' in self or -1 if absent. Self may be void. |
search(c:CHAR,st:INT):INT |
---|
**** | The index of the first appearance of `c' at location `st' or greater in self or -1 if absent. Self may be void. |
search(s:SAME):INT |
---|
**** | The index of the leftmost substring of self which matches `s'. -1 if none. Uses simple algorithm which has good performance unless the strings are special (eg. many repeated values). Either string may be void. (Void matches void at 0). |
search(s:SAME, st:INT):INT |
---|
**** | the index of the first appearance of `s' at location `st' or greater in self or -1 if not found. Self may be void. |
search_backwards(c:CHAR):INT |
---|
**** | The index of the last appearance of `c' in self or -1 if absent. Self may be void. |
search_backwards(c:CHAR,st:INT):INT |
---|
**** | The index of the last appearance of `c' in self before st,or -1 if absent. Self may be void. |
search_chars_from(s:SAME):INT |
---|
**** | The index of the first appearance in self of a character contained in `s' or -1 if none. Self or `s' may be void. |
size:INT |
---|
**** | The number of characters in self. 0 if self is void. |
str:STR |
---|
substring(beg:INT): SAME |
---|
substring(beg,num:INT):SAME |
---|
**** | The substring with `num' charcters whose first character has index `beg'. Self may be void if beg=0 and num=0. |
tail(i:INT):SAME |
---|
**** | The last `i' characters of self. Self may be void if i=0. |
upper:SAME |
---|
**** | A copy of self with each character in upper case. Self may be void. |
chunk!(chunk_size: INT): STR |
---|
**** | Yield successive chunks of self, defined by the chunk size "size"
_____s_::=_"122333444455555"; _____loop_#OUT+s.chunk!(1)+",";_end; _____"1,2,2,3,3,3,4,4,4,4,5,5,5,5,5" _____loop_#OUT+s.chunk!(5.times!)+",";_end; _____will_print_out_",1,22,333,4444,55555" |
elt!(once beg:INT):CHAR |
---|
**** | Yield the characters of self in order starting at `beg'. Self may be void. Modified (ben) |
elt!(once beg,once num:INT):CHAR |
---|
**** | Yield 'num' characters of self in order starting at `beg'. Self may be void. Modified (ben) |
elt!:CHAR |
---|
**** | Yield the characters of self in order. Self may be void. Modified (ben) |
ind!:INT |
---|
**** | Yield the indices of the characters of self in order. Self may be void. Modified (ben) |
separate!(s:$STR):STR |
---|
**** | On the first iteration just outputs `s', on successive iterations it outputs self followed by `s'. Useful for forming lists,
____loop_#OUT_+_",_".separate!(a.elt!)_end; |
split!(once c: CHAR): STR |
---|
**** | Yield successive substrings that are separated by the character "c"
_____s_::=_"This_is_\n_a_test_\n_of_split"; _____loop_#OUT+"Next_line:"+s.split!('\n');_end; The "c" characters will occur at the end of each string |
aclear .. Included as aclear |
---|
**** | Set each element of self to nil. Built-in. |
acopy(beg,num,srcbeg:INT, src:SAME) .. Included as acopy |
---|
**** | Copy `num' elements from `src' to self starting at index `beg' of self and index `srcbeg' of `src'. Built-in. |
acopy(beg,num:INT, src:SAME) .. Included as acopy |
---|
**** | Copy `num' elements from `src' to self starting at index `beg' of self. |
acopy(beg:INT, src:SAME) .. Included as acopy |
---|
**** | Copy as many elements from `src' to self as will fit when starting at index `beg' of self. |
acopy(src:SAME) .. Included as acopy |
---|
**** | Copy as many elements from `src' to self as will fit. Built-in. |
aelt!(once beg:INT):T .. Included as aelt! |
---|
**** | Yield each element of self starting at `beg'. Built-in. |
aelt!(once beg,once num:INT):T .. Included as aelt! |
---|
**** | Yield `num' successive elements of self starting at index `beg'. Built-in. |
aelt!(once beg,once num,once step:INT):T .. Included as aelt! |
---|
**** | Yield `num' elements of self starting at `beg' and stepping by `step' which must not be zero. Built-in. |
aelt!:T .. Included as aelt! |
---|
**** | Yield each element of self in order. Built-in. |
aind!:INT .. Included as aind! |
---|
**** | Yield the indices of self in order. |
array_ptr:C_PTR .. Included as array_ptr |
---|
aset!(val:T) .. Included as aset! |
---|
**** | Set successive elements of self to the values `val'. Built-in. |
aset!(once beg:INT,val:T) .. Included as aset! |
---|
**** | Set successive elements of self starting at `beg' to the values `val'. |
aset!(once beg,once num:INT,val:T) .. Included as aset! |
---|
**** | Set `num' successive elements of self starting at `beg' to the values `val'. |
aset!(once beg,once num,once step:INT, val:T) .. Included as aset! |
---|
**** | Set `num' elements of self starting at `beg' stepping by `step' to the values `val'. `step' must not be zero. |
aset(ind:INT, val:T) .. Included as aset |
---|
**** | Set the element of self with index `ind' to `val'. Built-in. |
asize:INT .. Included as asize |
---|
**** | The number of elements in self. Classes which inherit this may replace this by a constant to get constant sized objects (and the compiler may optimize certain operations in this case). Built-in. |
shared buf:FSTR; |
---|
**** | Character buffer. |
shared buf:FSTR; |
---|
**** | Character buffer. |
create(n:INT):SAME .. Included as create |
---|
**** | A new array with `n' elements. |
is_eq_helper(s:SAME,i:INT):BOOL |
---|
**** | Matt Kennel, INLS. The reason for this function's existence is that it will be overridden by "memcmp" in MACROS. |
is_legal_aelts_arg( beg, num, step:INT) :BOOL .. Included as is_legal_aelts_arg |
---|
**** | True if the arguments are legal values for `aelts'. |