forked from Mirrors/openclonk
add helper functions chars
parent
a882a6e64b
commit
17f98bd235
|
@ -19,4 +19,34 @@ global func TakeString(string str, int begin, int end)
|
|||
for (var index = begin; index < end; index++)
|
||||
reduced_str = Format("%s%c", reduced_str, GetChar(str, index));
|
||||
return reduced_str;
|
||||
}
|
||||
}
|
||||
|
||||
// Converts a char into a string.
|
||||
global func CharToString(int char)
|
||||
{
|
||||
return Format("%c", char);
|
||||
}
|
||||
|
||||
// Returns whether a char is a digit [0-9].
|
||||
global func CharIsDigit(int char)
|
||||
{
|
||||
return Inside(char, 48, 57);
|
||||
}
|
||||
|
||||
// Returns whether a char is a letter [A-Za-z].
|
||||
global func CharIsLetter(int char)
|
||||
{
|
||||
return CharIsLowerCase(char) || CharIsUpperCase(char);
|
||||
}
|
||||
|
||||
// Returns whether a char is a lower-case letter [a-z].
|
||||
global func CharIsLowerCase(int char)
|
||||
{
|
||||
return Inside(char, 97, 122);
|
||||
}
|
||||
|
||||
// Returns whether a char is an upper-case letter [A-Z].
|
||||
global func CharIsUpperCase(int char)
|
||||
{
|
||||
return Inside(char, 65, 90);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue