Find - StringUtil
Revision as of 16:44, 1 December 2013 by imported>Qqqbbb (→Parameters)
SKSE Member of: StringUtil Script
Returns the index of the first occurence of specified phrase inside given string, optionally starting on selected position. (This function requires SKSE)
Syntax
int Function Find(string str, string toFind, int startIndex = 0) global native
Parameters
- str: The string in which to search.
- toFind: The string to look for.
- startIndex: An optional index at which the function should start looking.
- Default: 0
Return Value
Index of the first occurence of the specified string, or -1 if nothing was found.
Also returns -1 if the given startIndex was invalid.
Examples
; looking for some words
String myString = "Apple Banana"
int index1 = StringUtil.Find(myString, "Banana")
; index1 = 6
int index2 = StringUtil.Find(myString, "e", 5)
; index2 = -1
int index3 = StringUtil.Find(myString, "Apple", 22)
; index3 = -1
Notes
This function is case-insensitive (like all SKSE string functions right now).