GetNthChar - StringUtil

From Creation Kit
Jump to: navigation, search

SKSE Member of: StringUtil Script

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

Syntax

String Function GetNthChar(string Str, int N) native

Parameters

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

Return Value

  • The character at N in Str as a string.

Examples

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

None

See Also