Syntax
int strindex( string str, string substr )
Description
strindex returns the numerical offset of a given string within another string. If the substr is not found, it returns -1.
Example
printf("%d\n",strindex("xxxfooxxx","foo"));
Returns: "3"
printf("%d\n",strindex("xxxfooxxx","bar"));
Returns: "-1"
Syntax
int strlen( string str )
Description
strlen returns the length of the string, str.
Example
printf("%d\n",strlen("foo"));
Returns: 3
Syntax
string strsub ( string str, int start, int length )
Description
strsub returns the substring of a given length starting at a given position in the string.
Example
printf("%s\n",strsub("xxxfooxxx",3,3))
Returns "foo".
printf(%s\n",strsub(xxxfooxxx",3,-1))
-1 returns the remainder of the string, "fooxxx".
Syntax
int sub ( string <regexp> string replacement string sourcestring string count )
Description
sub returns a new string from the sourcestring argument with the specified regular expression regexp replaced with the string specified in the replacement argument.
Example
result = sub("0x[[:xdigit:]]*:,"hex","These are numbers: 0xA8D, 0x34");