Skip to content

string_ord_at

CryoEagle edited this page Dec 26, 2018 · 5 revisions

string_ord_at

Checks a given string and returns the character code for the character at a given position.

Syntax:

string_ord_at(str, index)
Argument Description
string str The string to check
int index The position to get the character code from

Returns: string

Description

You can use this function to return a specific character code at a specific position within a string, with the index starting at 1 for the first character. If no character is found or the string is shorter than the value given to index, an empty string "" is returned.

Example:

string str = "Hello World";
char char_code = string_ord_at(str1, 7); 

This will get the character code for the seventh character (where "H" counts as the first) in string "str" and store it in the variable "char_code".

Back to strings

Clone this wiki locally