Difference between revisions of "StringUtil Script"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JohnB
(→‎SKSE Global Functions: Added StringUtil.split, present in SKSE since version 1.7.3.)
 
(5 intermediate revisions by 3 users not shown)
Line 16: Line 16:


== SKSE Global Functions ==
== SKSE Global Functions ==
'''int Function [[GetLength - StringUtil|GetLength]](string str)'''
*Returns the length of the string.


'''string Function [[GetNthChar - StringUtil|GetNthChar]](string str, int n)'''
:'''Int [[GetLength - StringUtil|GetLength]](String ''str'')'''
*Returns the character at n in str as a string.
:*Returns the length of the string.


'''bool Function [[IsUppercase - StringUtil|IsUppercase]](string c)'''
:'''String [[GetNthChar - StringUtil|GetNthChar]](String ''str'', Int ''n'')'''
*Returns whether the character is uppercase or not.
:*Returns the character at n in str as a string.


'''bool Function [[IsLowercase - StringUtil|IsLowercase]](string c)'''
:'''Bool [[IsLetter - StringUtil|IsLetter]](String ''c'')'''
*Returns whether the character is lowercase or not.
:*Returns whether the character is a letter or not.


'''bool Function [[IsLetter - StringUtil|IsLetter]](string c)'''
:'''Bool [[IsDigit - StringUtil|IsDigit]](String ''c'')'''
*Returns whether the character is a letter or not.
:*Returns whether the character is a digit or not.


'''bool Function [[IsDigit - StringUtil|IsDigit]](string c)'''
:'''Bool [[IsPunctuation - StringUtil|IsPunctuation]](String ''c'')'''
*Returns whether the character is a digit or not.
:*Returns whether the character is punctuation or not.


'''bool Function [[IsPunctuation - StringUtil|IsPunctuation]](string c)'''
:'''Bool [[IsPrintable - StringUtil|IsPrintable]](String ''c'')'''
*Returns whether the character is punctuation or not.
:*Returns whether the character is printable or not.


'''string Function [[ToUpper - StringUtil|ToUpper]](string str)'''
:'''Int [[Find - StringUtil|Find]](String ''str'', String ''toFind'', Int ''startIndex'')'''
*Returns the string as uppercase.
:*Returns the index of the first occurence of specified phrase inside the string, starting at given position.


'''string Function [[ToLower - StringUtil|ToLower]](string str)'''
:'''String [[Substring - StringUtil|Substring]](String ''str'', Int ''startIndex'', Int ''len'')'''
*Returns the string as lowercase.
:*Returns a portion of the string starting at given index with specified amount of characters.


'''int Function [[Find - StringUtil|Find]](string str, string toFind, int startIndex)'''
:'''Int [[AsOrd - StringUtil|AsOrd]](String ''c'')'''
*Returns the index of the first occurence of specified phrase inside the string, starting at given position.
:*Returns the decimal value of a character.


'''int Function [[Substring - StringUtil|Substring]](string str, int startIndex, int len)'''
:'''String [[AsChar - StringUtil|AsChar]](Int ''c'')'''
*Returns a portion of the string starting at given index with specified amount of characters.
:*Returns the decimal as a string character.


'''int Function [[AsOrd - StringUtil|AsOrd]](string c)'''
:'''String[] [[Split - StringUtil|Split]](String ''s'', String ''delim'')'''
*Returns the character as a number.
:*Returns array of strings separated by the specified delimiter.
 
'''string Function [[AsChar - StringUtil|AsChar]](int c)'''
*Returns the number as a string character.


== Member Functions ==
== Member Functions ==

Latest revision as of 04:53, 23 June 2023


Collection of generic string utility global functions. (These global functions require SKSE)

Definition[edit | edit source]

ScriptName StringUtil

Properties[edit | edit source]

None

SKSE Global Functions[edit | edit source]

Int GetLength(String str)
  • Returns the length of the string.
String GetNthChar(String str, Int n)
  • Returns the character at n in str as a string.
Bool IsLetter(String c)
  • Returns whether the character is a letter or not.
Bool IsDigit(String c)
  • Returns whether the character is a digit or not.
Bool IsPunctuation(String c)
  • Returns whether the character is punctuation or not.
Bool IsPrintable(String c)
  • Returns whether the character is printable or not.
Int Find(String str, String toFind, Int startIndex)
  • Returns the index of the first occurence of specified phrase inside the string, starting at given position.
String Substring(String str, Int startIndex, Int len)
  • Returns a portion of the string starting at given index with specified amount of characters.
Int AsOrd(String c)
  • Returns the decimal value of a character.
String AsChar(Int c)
  • Returns the decimal as a string character.
String[] Split(String s, String delim)
  • Returns array of strings separated by the specified delimiter.

Member Functions[edit | edit source]

None

Events[edit | edit source]

None