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 = |
int |
atof(char32[] ptr, int pos = |
int |
flen(char32[] ptr, int pos = |
int |
aton(char32[] ptr, int pos = |
int |
nlen(char32[] ptr, int pos = |
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 }