Returns the nth substring of a search string.
STRGET(num, "srchstr", "delimit", ignore)
num |
- |
An integer. The number of the substring to return. |
||||
"srchstr" |
- |
A string. The search string to search in. |
||||
"delimit" |
- |
Optional. A string specifying the characters used to separate srchstr into individual substrings. Defaults to a space delimiter character. |
||||
ignore |
- |
Optional. An integer, ignore empty substrings.
|
A string.
strget(2, "YOR:12.3 XINC:1.0 YREF:120.0")
returns: XINC:1.0 because that is the second substring.
By default, substrings are delimited by spaces. Set "delimit" to specify specific delimiter characters.
strget(2, "YOR:12.3 XINC:1.0 YREF:120.0",":")
returns: 12.3 XINC because the : is the separator character.
By default, empty substrings are ignored. The ignore parameter explicitly sets the empty substring behavior.
s1 = strget(2, "aaa,,ccc,ddd", ",");
s2 = strget(2, "aaa,,ccc,ddd", ",", 1);
s3 = strget(2, "aaa,,ccc,ddd", ",", 0);
s1 == "ccc"
s2 == "ccc"
s3 == ""
t1 = strget(3, "aaa,,ccc,ddd", ",");
t2 = strget(3, "aaa,,ccc,ddd", ",", 1);
t3 = strget(3, "aaa,,ccc,ddd", ",", 0);
t1 == "ddd"
t2 == "ddd"
t3 == "ccc"
The empty delimited substring is ignored in s1, s2, t1, t2 and processed in s3 and t3.