substr()
Return a specified portion of a string of characters.
Syntax
substr(text,start,length)
Parameter
Parameter | Definition |
---|---|
text | text from which a substring is to be returned The text can be a text string enclosed in double quotation marks, or one or more PSL commands that produce text as output. |
start | character position within text that is to be the first character of the substring The first character in text is character position 1. |
length | total number of characters returned from text |
Description
The substr() function returns the substring of text of length characters that starts at position start.
Example
The following is an example of the substr() function:
any_string = "The quick red fox jumped over the lazy brown dogs";
len = length(any_string);
i = 0;
while (i++ <= len){
printf("%s\n",substr(any_string,i,1));
}
len = length(any_string);
i = 0;
while (i++ <= len){
printf("%s\n",substr(any_string,i,1));
}
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*