Reference Guide > S Routines > STRPOS Function
  

STRPOS Function
Searches for the occurrence of a substring within an object string, and returns its position.
Usage
result = STRPOS(object, search_string[, position])
Input Parameters
object—The expression in which to search for the substring.
search_string—The substring to be searched for within object.
If object or search_string are not of type string, they are converted to string using the default formatting rules of PV‑WAVE. (These rules are described in the section Free Format Output in Chapter 8 of the PV‑WAVE Programmer’s Guide.)
position—(optional) The character position at which the search is begun. If position is omitted or is less than zero, the search begins at the first character (character position 0).
Returned Value
result—If search_string occurs in object, STRPOS returns the character position of the match; otherwise, it returns –1.
If object is an array, result is an array of the same structure, and each element contains the position of the substring within object.
If search_string is the null string, STRPOS returns the smaller of position or one less than the length of object.
Keywords
None.
Example
See the example for STRMID Function.
See Also
STRLEN,   STRLOWCASE,   STRMESSAGE,   STRPUTSTRUPCASE

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.