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 |
strcpy(int[] dest, int dpos, int[] src, int spos) |
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 |
strcat(int[] dest, int[] src, int spos) |
void |
strncat(int[] dest, int[] src, int spos, int n) |
void |
strncat(int[] dest, int[] src, int n) |
int |
strchr(char32[] ptr, int pos, char32 chr) |
int |
strrchr(char32[] ptr, int pos, char32 chr) |
int |
strstr(char32[] ptr, int pos, char32[] sub) |
int |
strspn(char32[] ptr, int pos, char32[] keys) |
int |
strcspn(char32[] ptr, int pos, char32[] keys) |
int |
strcmp(char32[] ptr1, int pos1, char32[] ptr2, int pos2) |
int |
strncmp(char32[] ptr1, int pos1, char32[] ptr2, int pos2, int n) |
int |
atoi(char32[] ptr, int pos) |
int |
ilen(char32[] ptr, int pos) |
int |
xtoi(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) |
bool |
sprintf_isMFCode(char32 chr) |
int |
sprintf_MFCodeToInt(char32 chr) |
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) |
int |
strcmp(char32[] ptr1, char32[] ptr2) |
int |
strncmp(char32[] ptr1, char32[] ptr2, int n) |
int |
strlen(char32[] ptr) |
void |
strcpy(char32[] dest, char32[] src) |
int |
atoi(char32[] ptr) |
void |
strcat(char32[] dest, char32[] src) |
int |
strchr(char32[] ptr, char32 chr) |
int |
strrchr(char32[] ptr, char32 chr) |
int |
strspn(char32[] ptr, char32[] keys) |
int |
strcspn(char32[] ptr, char32[] keys) |
int |
strstr(char32[] ptr, char32[] sub) |
int |
ilen(char32[] ptr) |
int |
xtoi(char32[] ptr) |
int |
itoa(char32[] ptr, int num) |
int |
xtoa(char32[] ptr, int num) |
int |
sprintf(char32[] ret, char32[] formatstr, int a0 = |
void |
printf(char32[] formatstr, int a0 = |
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 strcpy(int[] dest, int dpos, int[] src, int spos) π Source
String Manipulation String Copy Copys string βsrcβ into string βdestβ without checking for overflow in βdestβ
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 strcat(int[] dest, int[] src, int spos) π Source
String Concatenate Appends string βsrcβ onto string βdestβ (assuming dest has enough extra memory allocated to allow the operation)
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 strchr(char32[] ptr, int pos, char32 chr) π Source
String Searching String Character Returns the position of the first occurence of βcharacterβ in βstringβ, or -1 if none are found
int strrchr(char32[] ptr, int pos, char32 chr) π Source
String Reverse Character Returns the position of the last occurence of βcharacterβ in βstringβ starting from the end, or -1 if none are found
int strstr(char32[] ptr, int pos, char32[] sub) π Source
String Sub-String Returns the position of the first occurence of sub-string βsubβ in βstringβ, or -1 if sub is not found
int strspn(char32[] ptr, int pos, char32[] keys) π Source
String Span Returns the length of characters in βptrβ before a character not contained in βkeysβ is found
int strcspn(char32[] ptr, int pos, char32[] keys) π Source
String Complement Span Returns the length of characters in βptrβ before a character contained in βkeysβ is found
int strcmp(char32[] ptr1, int pos1, char32[] ptr2, int pos2) π Source
String Comparison String Compare Iterates through ptr1 and ptr2 until a character is found which is not the same in both strings, and then returns > 0 if the character is larger in ptr1, and < 0 if it is larger in ptr2. Returns 0 if the strings are equal
int strncmp(char32[] ptr1, int pos1, char32[] ptr2, int pos2, int n) π Source
strcmp up to βnβ characters
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 xtoi(char32[] ptr, int pos) π Source
Hexadecimal ASCII to Integer Returns the (positive) hexadecimal 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β
bool sprintf_isMFCode(char32 chr) π Source
Used by sprintf
int sprintf_MFCodeToInt(char32 chr) π Source
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 }
int strcmp(char32[] ptr1, char32[] ptr2) π Source
Now an internal function. -Z ( 15th May, 2019 )
int strncmp(char32[] ptr1, char32[] ptr2, int n) π Source
Now an internal function. -Z ( 15th May, 2019 )
int strlen(char32[] ptr) π Source
Internal as of 2.55 Alpha 23, 15th may, 2019 String Length Returns the length of string βstringβ
void strcpy(char32[] dest, char32[] src) π Source
int atoi(char32[] ptr) π Source
void strcat(char32[] dest, char32[] src) π Source
int strchr(char32[] ptr, char32 chr) π Source
int strrchr(char32[] ptr, char32 chr) π Source
int strspn(char32[] ptr, char32[] keys) π Source
int strcspn(char32[] ptr, char32[] keys) π Source
int strstr(char32[] ptr, char32[] sub) π Source
int ilen(char32[] ptr) π Source
int xtoi(char32[] ptr) π Source
int itoa(char32[] ptr, int num) π Source
int xtoa(char32[] ptr, int num) π Source
int sprintf(char32[] ret, char32[] formatstr, int a0 = 0
, int a1 = 0
, int a2 = 0
, int a3 = 0
, int a4 = 0
, int a5 = 0
, int a6 = 0
, int a7 = 0
, int a8 = 0
, int a9 = 0
, int aa = 0
, int ab = 0
, int ac = 0
, int ad = 0
, int ae = 0
, int af = 0
) π Source
Prints string βformatstrβ into βretβ according to the arguments inputted (see C function for reference) Maximum 16 arguments
Warning
Deprecated! Use the internal sprintf() instead.
void printf(char32[] formatstr, int a0 = 0
, int a1 = 0
, int a2 = 0
, int a3 = 0
, int a4 = 0
, int a5 = 0
, int a6 = 0
, int a7 = 0
, int a8 = 0
, int a9 = 0
, int aa = 0
, int ab = 0
, int ac = 0
, int ad = 0
, int ae = 0
, int af = 0
) π Source
Uses a buffer to print the results of sprintf(formatstr,β¦) straight to allegro.log
Warning
Deprecated! Use the internal printf() instead.