Difference between revisions of "UT FindSubString"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(Created page with '{{dafunction |name = UT_FindSubString |brief = Returns the position of a substring within a string. |param1type = string |param1name = sString |param1desc = the string to search...')
 
 
Line 33: Line 33:
 
<!-- == See also == -->
 
<!-- == See also == -->
 
<!-- This section contains links to articles, functions or constant groups. -->
 
<!-- This section contains links to articles, functions or constant groups. -->
 +
 +
[[Category:String functions]]

Latest revision as of 22:11, 10 February 2010

Returns the position of a substring within a string.

int UT_FindSubString(
string sString,
string sSubString,
int nInstance = 1
);
Parameters:
sString
the string to search
sSubString
the substring to search for
nInstance
The instance of the substring to return (default is the first instance).
Returns:

the starting index of the specified instance of the substring. -1 on error.

Source:

Core Resources.utility_h

Description

Returns the starting index of the specified instance of the substring sSubstring within the string sString. Returns -1 if the specified instance of the substring does not occur in the string. The search is 0 indexed, so if the substring occurs at the very beginning of the string this function will return 0. 'UT_FindSubString("monkey_laser_fun", "_", 2);' would return 12.