10.3.7 getStrPos (gets the position of character string)
Syntax
getStrPos character-string-1 character-string-2 [search-start-position]
Description
This command searches for the character string from the array specified for argument and outputs the position that is fully matched first (number of characters from the beginning to the position). This command outputs 0 if no character string is found.
The position from which search starts can be specified. If the search for the start position is omitted, search is started from the beginning of the character string assuming that the search start position is 1.
Arguments
- character-string-1
-
This command specifies the character string that position is obtained.
- character-string-2
-
This command specifies the character string to be searched.
- search-start-position
-
This command specifies the position from which the search starts.
Output to the standard output
Character string indicating the number of characters.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
Not less than 1 |
Termination with an error |
Notes
A value of not less than 1 can be specified for the search start position of argument, but whether the character string can be specified is not verified.
Examples
getStrPos abcdefg c # "3" is output. getStrPos abcdefg cd # "3" is output. getStrPos abcdabcd c 2 # "3" is output. (Position of c that appears at the second letter or later) getStrPos abcdabcd c 4 # "7" is output. (Position of c that appears at the fourth letter or later) getStrPos abcdabcd cd # "3" is output. getStrPos ABCDabcd cd # "7" is output. getStrPos ab\tcd \t # "3" is output.