Background for Skyrim SE
Member of the StringUtil script
intfunctionFind(strings, stringtoFind, intstartIndex=0)NativeGlobal

Description

Wiki Description

Returns the index of the first occurence of specified phrase inside given string, optionally starting on selected position. (This function requires SKSE)

Documentation Comment

returns the index of the first character of toFind inside string s
returns -1 if toFind is not part of the string or if startIndex is invalid


Caveats

CK Wiki - Notes

This function is case-insensitive (like all SKSE string functions right now).


Parameters

  1. strings

    CK Wiki Description

    The string in which to search.

  2. stringtoFind

    CK Wiki Description

    The string to look for.

  3. intstartIndex=0

    CK Wiki Description

    An optional index at which the function should start looking.

    • Default:0

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

Auto-Generated Example

string myString__s
string myString__toFind
int myInt__startIndex

int returnedValue = StringUtil.Find(myString__s, myString__toFind, myInt__startIndex)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.