GetNthChar - StringUtil

From the CreationKit Wiki
Jump to navigation Jump to search

SKSE Member of: StringUtil Script

Returns the character at the given index in the given string. (This function requires SKSE)

Syntax[edit | edit source]

String Function GetNthChar(string Str, int N) native

Parameters[edit | edit source]

  • Str: The string to search in.
  • N: The index of the character in the string.

Return Value[edit | edit source]

  • The character at N in Str as a string.

Examples[edit | edit source]

string posInString = StringUtil.getNthChar("Hello, World!", 4)
debug.notification("Character at position 4 in the given string is " + posInString + ".")
debug.trace("Character at position 4 in the given string is <" + posInString + ">.")
; Character at position 4 in the given string is <O>.


import StringUtil
;;;
string posInString = getNthChar("01234567", 5)
int x = posInString as int
debug.notification(2 * x)
; 10

Notes[edit | edit source]

None

See Also[edit | edit source]