# String

## String concatenation​

String concatenation is made using the + operator. Examples:

   "ab" + "cd" + "ef";  returns "abcdef"   "ab"+12+"de"; returns "ab12de"   "ab"+1+2; returns "ab12"   1+2+"ab"; is illegal since the first argument of '+' must be a string!

## Match string against regular expression​

   like(Charstring string, Charstring pattern) -> Boolean

In a pattern string * matches sequence of characters and ? matches a single character.

Examples:

   like("abc","??c") returns TRUE   like("ac","a*c") returns TRUE   like("ac","a?c") fails   like("abc","a[bd][dc]"); returns TRUE   like("abc","a[bd][de]"); fails

## Functions​

aton(Charstring s)->Number n

Convert string s to number

capitalize(Charstring s)->Charstring

Capitalize string s

charstring(Object x)->Charstring

Cast x to string

concat(Charstring x,Charstring y)->Charstring

Concatenate strings y and y. Same as x+y

dim(Charstring str)->Integer

Number of characters in string str

length(Charstring str)->Integer

Legacy; use dim(str) instead

like(Charstring str,Charstring pat)->Boolean

Match string str against regualar expression pat

like_i(Charstring str,Charstring pat)->Boolean

Match string str against regualar expression pat ignoring case

locate(Charstring substr,Charstring str)->Integer

The position of the first occurrence of substring substr in str

locate_right(Charstring substr,Charstring str)->Integer

The position of the last occurrence of substring substr in str

lower(Charstring s)->Charstring

Lower case string s

ltrim(Charstring chars,Charstring str)->Charstring

Remove characters in chars from beginning of str

not_empty(Charstring s)->Boolean

Is string s empty or all whitespaced? The characters space, tab, or new line are counted as whitespace

ntoa(Number x)->Charstring

Convert number x to string

plus(Charstring x,Object y)->Charstring r

Concatenate strings x and y. Inverses produce prefix or suffix

replace(Charstring str,Vector of Charstring from_str,       Vector of Charstring to_str)->Charstring

The string str with all occurrences of the first matching strings in from_str replaced by the correspondig strings in to_str

rtrim(Charstring chars,Charstring str)->Charstring

Remove characters in chars from end of str

section(Charstring str,Number l,Number u)->Charstring

The substring of str starting at position l and ending at u

skip(Charstring str,Number l)->Charstring

Skip l characters in the beginning of string str

split(Charstring str,Charstring delim)->Vector of Charstring

Create a vector of substrings in str delimited by delim Example: split('a bc d', ' ') -> ['a', 'bc','d']

split(Charstring str)->Vector of Charstring

Unoack str into a vector of characters Example: split('abc') -> ['a', 'b', 'c']

stringify(Object o)->Charstring

Convert object o to string. The elements are stringified if o is bag or stream

trim(Charstring chars,Charstring str)->Charstring

Remove characters in chars from beginning and end of str

unstringify(Charstring s)->Object o

Parse string s to object

upper(Charstring str)->Charstring uppr

Upper case string str

vref(Charstring str,Number i)->Charstring

Same as str[i] to access character i in str