string_functions.zh#

Functions#

int

NumCharsOf(char32[] ptr, char32 chr)

int

NumCharsOf(char32[] ptr, int pos, char32 chr)

bool

isControlCode(char32 chr)

bool

isNumber(char32 chr)

bool

isAlphabetic(char32 chr)

bool

isAlphaNumeric(char32 chr)

bool

isHex(char32 chr)

bool

isUpperCase(char32 chr)

bool

isLowerCase(char32 chr)

bool

isSpace(char32 chr)

bool

isVowel(char32 chr)

bool

ContainsChar(char32 chr, char32[] buffer)

int

ContainsCharPos(char32 chr, char32[] buffer)

bool

ContainsChar(char32 chr, int pos, char32[] buffer)

int

ContainsCharPos(char32 chr, int pos, char32[] buffer)

char32

UpperToLower(char32 chr)

char32

LowerToUpper(char32 chr)

char32

ConvertCase(char32 chr)

void

memset(untyped[] ptr, int pos, untyped value, int n)

void

memset(untyped[] ptr, untyped value, int n)

void

memcpy(untyped[] dest, int dpos, untyped[] src, int spos, int n)

void

memcpy(untyped[] dest, untyped[] src, int n)

void

memcpy(untyped[] dest, untyped[] src)

untyped

memmove(untyped[] dest, int dpos, untyped[] src, int spos, int n)

void

arrayset(untyped[] a, untyped[] args, untyped[] varargs …)

void

strncpy(int[] dest, int dpos, int[] src, int spos, int n)

void

strncpy(int[] dest, int[] src, int n)

void

remchr(char32[] ptr, int pos)

void

remchr(char32[] ptr)

void

remnchr(char32[] ptr, int pos, int n)

void

strncat(int[] dest, int[] src, int spos, int n)

void

strncat(int[] dest, int[] src, int n)

int

atoi(char32[] ptr, int pos)

int

ilen(char32[] ptr, int pos)

int

xlen(char32[] ptr, int pos = 0)

int

atof(char32[] ptr, int pos = 0)

int

flen(char32[] ptr, int pos = 0)

int

aton(char32[] ptr, int pos = 0)

int

nlen(char32[] ptr, int pos = 0)

int

itoa(char32[] ptr, int pos, int num)

int

xtoa(char32[] ptr, int pos, int num, bool upper)

int

xtoa(char32[] ptr, int num, bool upper)

int

ftoa(char32[] ptr, int pos, int num, bool printall)

int

ftoa(char32[] ptr, int num, bool printall)

int

ftoa(char32[] ptr, int pos, int num)

int

ftoa(char32[] ptr, int num)

int

ntoa(char32[] ptr, int pos, int num)

int

ntoa(char32[] ptr, int num)

void

strcatf(int[] dest, untyped arg, int format)

void

strncatf(int[] dest, untyped arg, int format, int n)

int

ReturnStringCharPos(char32[] ptr, char32 chr)

int

ReturnStringCharPos(char32[] ptr, int pos, char32 chr)

int

ReturnStringCharPosRev(char32[] ptr, char32 chr)

int

ReturnStringCharPosRev(char32[] ptr, int pos, char32 chr)

char32

IsChar(char32 chr)

bool

IsChar(char32 chr, char32 comp)

void

ScreenPrint(char32[] s, untyped v, int[] args)

Function descriptions#

int NumCharsOf(char32[] ptr, char32 chr) πŸ”— Source

ZScript string handling functions, akin to those found in C Returns the number of chracters of a given type in a specified string.


int NumCharsOf(char32[] ptr, int pos, char32 chr) πŸ”— Source


bool isControlCode(char32 chr) πŸ”— Source

Single character functions Returns true if β€˜chr’ is in the control code range of ascii characters


bool isNumber(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is in the range of ascii characters β€˜0’ to β€˜9’


bool isAlphabetic(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is an alphabetic character


bool isAlphaNumeric(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is an alphanumeric character


bool isHex(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is in the set { β€˜0’-β€˜9’, β€˜A’-β€˜F’ , β€˜a’-β€˜f’ }


bool isUpperCase(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is an upper-case character


bool isLowerCase(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is a lower-case character


bool isSpace(char32 chr) πŸ”— Source

Retruns true if a β€˜chr’ is a blank space.


bool isVowel(char32 chr) πŸ”— Source

Returns true if β€˜chr’ is a vowel.


bool ContainsChar(char32 chr, char32[] buffer) πŸ”— Source

Returns true if the string contains a specific character.


int ContainsCharPos(char32 chr, char32[] buffer) πŸ”— Source

Returns first character position if the string contains a specific character, else -1.


bool ContainsChar(char32 chr, int pos, char32[] buffer) πŸ”— Source

Returns true if the string contains a specific character.


int ContainsCharPos(char32 chr, int pos, char32[] buffer) πŸ”— Source

Returns first character position if the string contains a specific character, else -1.


char32 UpperToLower(char32 chr) πŸ”— Source

Converts all upper case characters to lower case, leaving non-alphabetic characters unchanged


char32 LowerToUpper(char32 chr) πŸ”— Source

Converts all lower case characters to upper case, leaving non-alphabetic characters unchanged


char32 ConvertCase(char32 chr) πŸ”— Source

Converts lower case to upper case and upper case to lower case


void memset(untyped[] ptr, int pos, untyped value, int n) πŸ”— Source

Memory Manipulation Memory Set Sets block of memory of size β€˜n’ pointed by β€˜ptr’ to β€˜value’


void memset(untyped[] ptr, untyped value, int n) πŸ”— Source


void memcpy(untyped[] dest, int dpos, untyped[] src, int spos, int n) πŸ”— Source

Memory Copy Copys block of memory pointed by β€˜src’ of size β€˜n’ to β€˜dest’


void memcpy(untyped[] dest, untyped[] src, int n) πŸ”— Source


void memcpy(untyped[] dest, untyped[] src) πŸ”— Source


untyped memmove(untyped[] dest, int dpos, untyped[] src, int spos, int n) πŸ”— Source

Memory Move As memcpy, but uses a buffer so memory space can overlap


void arrayset(untyped[] a, untyped[] args, untyped[] varargs …) πŸ”— Source

Array Set Assign all elements of array.


void strncpy(int[] dest, int dpos, int[] src, int spos, int n) πŸ”— Source

As strcpy, but only takes the first β€˜n’ characters from src


void strncpy(int[] dest, int[] src, int n) πŸ”— Source


void remchr(char32[] ptr, int pos) πŸ”— Source

Remove Characters Remove all characters starting from pointer β€˜string’


void remchr(char32[] ptr) πŸ”— Source


void remnchr(char32[] ptr, int pos, int n) πŸ”— Source

Remove β€˜n’ characters and shift string back to pointer β€˜string’


void strncat(int[] dest, int[] src, int spos, int n) πŸ”— Source

strcat up to β€˜n’ characters in src


void strncat(int[] dest, int[] src, int n) πŸ”— Source


int atoi(char32[] ptr, int pos) πŸ”— Source

Converting between variables and strings ASCII to Integer Returns the decimal integer pointed by β€˜string’


int ilen(char32[] ptr, int pos) πŸ”— Source

Integer Length Returns the length of characters of the decimal integer pointed by β€˜string’


int xlen(char32[] ptr, int pos = 0) πŸ”— Source

Hexadecimal Length Returns the length of characters of the (positive) hexadecimal integer pointed by β€˜string’


int atof(char32[] ptr, int pos = 0) πŸ”— Source

ASCII to Float Returns the floating point number pointed by β€˜string’


int flen(char32[] ptr, int pos = 0) πŸ”— Source

Float Length Returns the length of characters of the floating point number pointed by β€˜string’


int aton(char32[] ptr, int pos = 0) πŸ”— Source

ASCII to Number Calls either atoi or atof depending on context


int nlen(char32[] ptr, int pos = 0) πŸ”— Source

Number Length Calls either flen or ilen depending on context


int itoa(char32[] ptr, int pos, int num) πŸ”— Source

Integer to ASCII Places integer β€˜num’ into string β€˜string’ without checking for overflow, and returns the number of characters used


int xtoa(char32[] ptr, int pos, int num, bool upper) πŸ”— Source

Hexadecimal Integer to ASCII Places integer β€˜num’ into string β€˜string’ in base 16 without checking for overflow, and returns the number of characters used


int xtoa(char32[] ptr, int num, bool upper) πŸ”— Source


int ftoa(char32[] ptr, int pos, int num, bool printall) πŸ”— Source

Float to ASCII Places float β€˜num’ into string β€˜string’ without checking for overflow, and returns the number of characters used. If β€˜printall’ is true, it will add 4 decimal places regardless of the most significant digit


int ftoa(char32[] ptr, int num, bool printall) πŸ”— Source


int ftoa(char32[] ptr, int pos, int num) πŸ”— Source


int ftoa(char32[] ptr, int num) πŸ”— Source


int ntoa(char32[] ptr, int pos, int num) πŸ”— Source

Number to ASCII Checks whether β€˜num’ is an integer or not, and calls the appropriate function


int ntoa(char32[] ptr, int num) πŸ”— Source


void strcatf(int[] dest, untyped arg, int format) πŸ”— Source

String Formating String Concatenate Format Appends β€˜arg’ onto β€˜dest’ as the MF_ constant passed into β€˜format’


void strncatf(int[] dest, untyped arg, int format, int n) πŸ”— Source

As strcatf, using only β€˜n’ characters of β€˜arg’


int ReturnStringCharPos(char32[] ptr, char32 chr) πŸ”— Source


int ReturnStringCharPos(char32[] ptr, int pos, char32 chr) πŸ”— Source


int ReturnStringCharPosRev(char32[] ptr, char32 chr) πŸ”— Source


int ReturnStringCharPosRev(char32[] ptr, int pos, char32 chr) πŸ”— Source


char32 IsChar(char32 chr) πŸ”— Source


bool IsChar(char32 chr, char32 comp) πŸ”— Source


void ScreenPrint(char32[] s, untyped v, int[] args) πŸ”— Source

Prints a formatted string to the screen. int v can be a string, a float, or an int and is inserted to the string using the tokens %s, %f, and %d respectively. int args is an array literal with the following format required: { LAYER, X, Y, FONT, TEXT_COLOUR, TEXT_BG_COLOUR, FORMAT, OPCITY }