Static extension with useful string helper methods.
// Put this after your imports and before the class declaration
using koui.util.StringUtil;
// You can then use the methods from this class like this:
var reversed = "myString".reverse(); Static methods
staticcanPrintChar(char:String, newLineAllowed:Bool = false):Bool
Compares the given character against a list of characters that cannot be printed (ASCII control characters for example) and returns true if the character does not match those non-printable characters.
If newLineAllowed is true, newline (\n) and carriage return (\r)
characters will return true.
Parameters:
char | The character that should be compared |
|---|---|
newLineAllowed | Whether |
statictoTitleCase(s:String):String
Converts the first character of the given string to uppercase. All other characters remain untouched.
staticunescape(s:String):String
Unescapes a given string. The following characters are unescaped:
\n -> Newline
\r -> Carriage Return
\t -> Tab
\" -> "
\\ -> \