Difference between revisions of "Substring - StringUtil"
Jump to navigation
Jump to search
imported>JohnB (Created page with "Category:Scripting Category:Papyrus Category:SKSE '''SKSE Member of:''' StringUtil Script Returns a portion of the string starting at given index, optionally ...") |
imported>JohnB m (→Notes) |
||
Line 37: | Line 37: | ||
== Notes == | == Notes == | ||
Invalid len value will work as if 0 was given. | Invalid len value will work as if 0 was given.<br/> | ||
This function is case-insensitive (like all SKSE string functions right now). | This function is case-insensitive (like all SKSE string functions right now). | ||
Revision as of 17:40, 19 August 2012
SKSE Member of: StringUtil Script
Returns a portion of the string starting at given index, optionally with specified amount of characters. (This function requires SKSE)
Syntax
string Function Substring(string str, int startIndex, int len = 0) global native
Parameters
- str: The string from which to retrieve the substring.
- startIndex: Starting character position of a substring.
- len: An optional length of the substring. Default of 0 means for the entire string.
- Default: 0
Return Value
Portion from the given string. Returns none if the given startIndex was invalid.
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"
Notes
Invalid len value will work as if 0 was given.
This function is case-insensitive (like all SKSE string functions right now).