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

Description

Wiki Description

Returns a portion of the string starting at given index, optionally with specified amount of characters. (This function requires SKSE)

Documentation Comment

returns a substring of the specified string starting at startIndex and going for len characters
or until the end of the string. Default len of 0 means for the entire string


Caveats

CK Wiki - Notes

Invalid len value will work as if 0 was given.
This function is case-insensitive (like all SKSE string functions right now).


Parameters

  1. strings

    CK Wiki Description

    The string from which to retrieve the substring.

  2. intstartIndex

    CK Wiki Description

    Starting character position of a substring.

  3. intlen=0

    CK Wiki Description

    An optional length of the substring. Default of 0 means for the entire string.

    • Default:0

Examples

Import StringUtil

string ss = "Sample string"
string s1 = Substring(ss, 5) 
;"e string"
string s2 = Substring(ss, 2, 4) 
;"mple"
string s3 = Substring(ss, 20) 
;none
string s4 = Substring(ss, 0, -1) 
;"sample string"

Auto-Generated Example

string myString__s
int myInt__startIndex
int myInt__len

string returnedValue = StringUtil.Substring(myString__s, myInt__startIndex, myInt__len)

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.