Repository navigation
String Utilities
YAMP also comes with some handy helper methods which you can use to implement your custom syntax. All of these methods are accessed via YAMP.StringHelper
YAMP.StringHelper.is_whitespace(c);Checks if a certain character is a whitespace.
Arguments
- c: the character to check
Return
- Boolean: whether the character is a whitespace
YAMP.StringHelper.is_valid_char(c);Checks if a certain character is a valid char. This includes ascii, symbols and unicodes, excluding whitespace characters and private use area unicodes.
Arguments
- c: the character to check
Return
- Boolean: whether the character is considered valid
YAMP.StringHelper.is_text_char(c);Checks if a character is a text character. This includes a-z, A-Z and 0-9
Arguments
- c: the character to check
Return
- Boolean: whether the character is considered a text character
YAMP.StringHelper.is_number(c);Checks if a character is a number 0-9
Arguments
- c: the character to check
Return
- Boolean: whether the character is considered a number
YAMP.StringHelper.insert_substring(string: string, start_pos: number, length: number, insert: string)Replaces a part of the input string with a new string. The new string can be of any length.
Arguments
- string: the input string
- start_pos: the start position at which we should start replacing
- length: the amount of characters to replace. This can be 0
- insert: the replacement string to insert
Return
- string: the modified string
YAMP.StringHelper.turn_into_ascii(string: string)Turns any text into ascii compatable text by removing any symbols and replacing spaces with -
Arguments
- string: the input string
Return
- string: the resulting ascii only string
~ wiki by theblackswitch