up | previous | next | Tom Wetmore | ttw@shore.net | LifeLines
These functions provide string handling. Many of them use an approach to memory management chosen to minimize memory use. A function using this approach constructs its output string in its own string buffer, reusing that buffer each time it is called. When a function using this approach returns a string value it returns its buffer. In consequence the strings returned by these functions must be either used or saved before the function is called again.
Function | Description |
---|---|
string lower(string) | Lower returns a copy of its argument string with every letter in lower case. Upper and lower use the buffer approach. |
string upper(string) | Upper returns a copy of its argument string with every letter in upper case. |
string capitalize(string) | Capitalize converts the first character of its argument, if it is a letter, to upper case; it operates on and returns its argument. |
string trim(string, int) | Trim shortens a string to the length given by the second parameter. If the string is already that length or shorter the string is not changed. Trim uses the buffer return method. |
string rjustify(string, int) | Rjustify right justifies a string into another string of the length given by the second parameter. If the original string is shorter than the justified string, blanks are inserted to the left of the original string; if the string is longer than the justified string, the original string is truncated on the right. Rjustify creates and returns a new string. |
string save(string) | Save creates and returns a copy of the argument string. It is needed because many built-in string functions use the buffer return method; if a string is to be used repeatedly or long after it is returned from a such a function, it should first be saved using this function. |
string strsave(string) | Strsave is the same function as save. |
string concat(string [,string]+) | Concat and strconcat catenate strings and return the result. They can take two to 32 string arguments; null arguments are allowed. The arguments are catenated together into a single, newly allocated string, which is returned. |
string strconcat(string [,string]+) | Strconcat is the same function as concat. |
int strlen(string) | Strlen returns the length of the string argument. |
string substring(string, int, int) | Substring returns a substring of the first argument. The second and third arguments are the indices of the first and last characters in the argument string to use to form the substring; the indexes are relative one. Substring uses the buffer return method. |
int index(string, string, int) | Index returns the character index of the nth occurrence of a substring within a string. The index is the relative one character offset to the beginning of the substring. The first argument is the string; the second argument is the substring; and the third argument is the occurrence number. |
string d(int) | D, card, ord, alpha and roman convert integers to strings. D converts an integer to a numeric string (e.g., 1, 2, ...). |
string card(int) | Card converts an integer to a cardinal number string (e.g., one, two, three). |
string ord(int) | Ord converts an integer to an ordinal number (e.g., first, second, third). |
string alpha(int) | Alpha converts an integer to a Latin letter (e.g., a, b, c). |
string roman(int) | Roman converts an integer to a Roman numeral (e.g., i, ii, iii). |
string strsoundex(string) | Strsoundex converts an arbitrary string to a SOUNDEX value. Non-Latin letters are ignored. |
int strtoint(string) | Strtoint converts a numeric string to an integer. |
int atoi(string) | Atoi is the same function as strtoing. |
int strcmp(string, string) | Strcmp compares two strings and returns an integer that is less than zero, equal to zero, or greater than zero, if, respectively, the first string is lexicographically less than, equal to, or greater than the second string. |
Bool eqstr(string, string) | Eqstr returns 1 if two strings are equal and 0 otherwise. |
Bool nestr(string, string) | Nestr returns 1 if two strings are unequal and 0 otherwise. |
up | previous | next | Tom Wetmore | ttw@shore.net | LifeLines
1/1/00