Web Home
Getting Started
Manual
Quick Reference
Language Reference
Function Reference
I/O Reference

Language Reference Function Reference Including Source Files Comments Issuing Shell Commands Matrix Multiplication Information About Variables Elementary Functions Advanced Array Indexing Index Range Functions Logical Functions Interpolation and Lookup Functions Sorting Transposing Manipulating Strings Generating Simple Meshes Using Pointers Instancing Data Structures Reshaping Arrays I/O Reference | # Yorick Function Reference ## 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 `pointer` p 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.