|
Manipulating StringsYorick type string is a pointer to a 0-terminated array of char. A string with zero characters - "" - differs from a zero pointer - string(0). A string variable s can be converted to a pointer to a 1-D array of char, and such a pointerp can be converted back to a string: p=pointer(s); s=string(p); These conversions copy the characters, so you can't use the pointer p to alter the characters of s. Given a string or an array of strings s: strlen(s ) number of characters in each element of s
The strtok function returns a 2-by-dimsof(s) array of strings - the first token followed by the remainder of the string. The token will be string(0) if no tokens were present; the remainder of string will be string(0) if there are no characters after the token. |