AsOrd - StringUtil

Revision as of 18:53, 29 April 2018 by imported>SniffleMan (→‎Parameters: Added notes about usage)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

SKSE Member of: StringUtil Script

Returns the decimal equivalent of the given character. (This function requires SKSE)

SyntaxEdit

int Function AsOrd(string c) global native

ParametersEdit

  • c: The character to convert to decimal. Converts only the first character in the given string.

Return ValueEdit

The decimal equivalent of the passed character.
Returns 0 if the string was empty.

ExamplesEdit

Import StringUtil

String myString = "a"
Int decimal = AsOrd(myString) ; decimal == 65 == A

myString = "A"
decimal = AsOrd(myString) ; decimal == 65 == A

myString = "Long string"
decimal = AsOrd(myString) ; decimal == 76 == L

myString = ""
decimal = AsOrd(myString) ; decimal == 0

NotesEdit

This function returns the decimal equivalent, not the hexadecimal equivalent.
This function is case-insensitive (like all SKSE string functions right now).

See AlsoEdit