Manipulating Strings

Yorick 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. The strchar function directly converts between string and char data.

Given a string or an array of strings s:

strlen(s )           number of characters in each element of s
strpart(s, rng)      returns substring rng of s
strfind(pat, s)      returns rng where pat occurs in s
strgrep(pat, s)      regular expression version of strfind
strword(s, delims)   returns rng of words in s
streplace(s, rng, to replaces rng of s by to

The strfind, strgrep, and strword functions return rng lists suitable as inputs to strpart or streplace. Other string manipulation functions include strmatch, strglob, strcase, and strtrim. Use help for details.