»Import: strings
The strings import exposes common string operations.
»strings.has_prefix(s, prefix)
Returns true if s
starts with prefix
.
»strings.has_suffix(s, suffix)
Returns true if s
ends with suffix
.
»strings.join(a, sep)
Joins a list with the string supplied by sep
.
Multi-dimensional lists are supported, and non-string primitive types will be converted to their string equivalents. Maps and other complex non-list types are not supported.
»strings.trim_prefix(s, prefix)
Trim the prefix from the string s
. If the string doesn't have the
prefix, then the string is returned unmodified.
»strings.trim_suffix(s, suffix)
Trim the suffix from the string s
. If the string doesn't have the
suffix, then the string is returned unmodified.
»strings.to_lower(s)
Lowercase the string s.
»strings.to_upper(s)
Uppercase the string s.
»strings.split(s, sep)
Split the string 's' via a substring 'sep'. If 'sep' is not contained in 's', the return value will be a single-element list containing only 's'. As a special-case, if the input is already a list, it will be returned as-is. This allows calling the split function when not knowing if the input is already a list or not.