Module jls.util.strings
Provide string helper functions.
Functions
split (value, pattern, plain) | Returns a list of strings split at each pattern. |
cuts (value, ...) | Returns a list of strings cut at each length. |
hash (value) | Returns an integer for the specified string. |
formatInteger (value[, radix[, len[, chars]]]) | Returns a string representing the specified integer in the specified radix. |
escape (value) | Returns the pattern corresponding to the specified string with the magic characters ^$()%.[]*+-? |
Functions
- split (value, pattern, plain)
-
Returns a list of strings split at each pattern.
Parameters:
- value string The string to split.
- pattern string The pattern used to split the string.
- plain boolean true to find the pattern as a plain string.
Returns:
-
table
a list of strings split at each pattern.
- cuts (value, ...)
-
Returns a list of strings cut at each length.
Parameters:
- value string The string to split.
- ... number The ordered lengths to cut.
Returns:
-
table
a list of strings cut at each pattern.
- hash (value)
-
Returns an integer for the specified string.
If two strings are equals then each string produce the same integer.
The result integer uses all the integer possible values from math.mininteger to math.maxinteger.
The result integer for a specific string may change in futur versions.
Parameters:
- value string The string to hash.
Returns:
-
integer
a hash integer value.
- formatInteger (value[, radix[, len[, chars]]])
-
Returns a string representing the specified integer in the specified radix.
Parameters:
- value integer The integer to format.
- radix integer The radix to use from 2 to 64, default is 10. (optional)
- len integer The minimal length of the resulting string padded with zero. (optional)
- chars string A string containing the characters used to format. (optional)
Returns:
-
string
a string representing the integer.
- escape (value)
-
Returns the pattern corresponding to the specified string with the magic characters ^$()%.[]*+-? escaped.
Parameters:
- value string The string to escape.
Returns:
-
string
The corresponding pattern.