STRINGS LIBRARY
A Programming Language Manual




strlen
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int strlen( s )

IN
str s string
OUT
int string's length

Returns the number of characters in the string s.



 C/C++ source code


strpos
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int strpos( s1, s2, pos=0 )

IN
str s1 string to search in
str s2 string to search for
int pos=0 search starting position (optional)
OUT
int found position or -1 if not found

Searches in the string s1 for the presence of string s2, starting from the specified position #pos.
If the start position is not specified, the search will begin with the first character of s1 (at position 0).
Returns the first position where s2 was found, or -1 if not found at all.




 C/C++ source code


stripos
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int stripos( s1, s2, pos=0 )

IN
str s1 string to search in
str s2 string to search for
int pos=0 search starting position (optional)
OUT
int found position or -1 if not found

Same as strpos, but case insensitive.

 C/C++ source code


strposr
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int strposr( s1, s2, pos=0 )

IN
str s1 string to search in
str s2 string to search for
int pos=0 search starting position (optional)
OUT
int found position or -1 if not found

Same as strpos, but it searces from right to left, starting with the given position (inclusive).
If the start position is not specified, the search will begin from the last character of s1.




 C/C++ source code


striposr
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int striposr( s1, s2, pos=0 )

IN
str s1 string to search in
str s2 string to search for
int pos=0 search starting position (optional)
OUT
int found position or -1 if not found

Same as strposr, but case insensitive.

 C/C++ source code


strchr
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int strchr( s1, s2, pos=0 )

IN
str s1 string to search in
str s2 characters to search for
int pos=0 search starting position (optional)
OUT
int found position or -1 if not found

Searches for any characters from string s2 that are present in string s1.
If the start position is not specified, the search will begin with the first character of s1 (at position 0).
Returns the first position in s1, where a character form the s2 was found.
If, from the specified start position, until the end of s1, no characters from the second string were found, -1 is returned.




 C/C++ source code


strskip
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
int strskip( s1, s2, pos=0 )

IN
str s1 string to process
str s2 characters to skip
int pos=0 position to start skipping (optional)
OUT
int position after skipping

Starting with the specified position in string s1, it skips all characters found in the second string s2.
If the start position is not specified, the processing will begin with the first character of s1 (at position 0).
Returns the position of the first character in s1, that is not found in s2.
If all characters from s1 are found in the s2 too, then the whole length of s1 is returned.




 C/C++ source code


strsub
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strsub( s, pos, count )

IN
str s string to substract from
int pos position of the substring
int=all count number of elements of the substring (optional)
OUT
str substring

Returns a substring (a part) of the string s, starting with position pos and containing count characters (if available).
If the optional count parameter is not specified, the substring will represent the last part s1, from the start position inclusive.




 C/C++ source code


strlwr
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strlwr( s )

IN
str s string
OUT
str lower case string

Returns the string s converted to lower case.
All characters from 'A' to 'Z' become 'a' to 'z'.




 C/C++ source code


strupr
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strupr( s )

IN
str s string
OUT
str upper case string

Returns the string s converted to upper case.
All characters from 'a' to 'z' become 'A' to 'Z'.




 C/C++ source code


strtrim
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strtrim( s1, s2 )

IN
str s1 string to be trimmed
str s2 characters to trim
OUT
str trimmed string

Processes the string s1 by removing beginning and ending characters that are also found in string s2 and return the result.



 C/C++ source code


strreplace
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strreplace( source, search, replace, pos, count )

IN
str source string in which we replace
str search string to search for
str replace string to replace with
int pos start position, default 0 (optional)
int count count length, default to the end of string (optional)
OUT
str string with all found string replaced

Finds all replace sequences and replaces them with replace string. Returns the result.



 C/C++ source code


strexplode
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
tab strexplode( s, separator )

IN
str s string
int separator ASCII code of the separator character
OUT
tab exploded table with substrings

Creates a table containing substrings from s, separated by a specified character.
The separator character is given throught it's ASCII code.




 C/C++ source code


strimplode
( lib: Strings, file: ../src/gs/gslib_strings.cpp )
str strimplode( t, separator )

IN
tab t table of substrings
int separator ASCII code of the separator character
OUT
str imploded string with separators

Concatenates all the string elements from a table t, into a string, separating them with a specified character.
Non string elements from the table are ignored.




 C/C++ source code