String
Edit on GitHubUtilities for working with strings.
Values
String.concat
Concatenate two strings.
String.length
Computes the character length of the input string.
String.byteLength
Returns the byte length of the input string.
String.indexOf
Finds the start index of a substring.
Parameters:
- sub: The substring to find
- input: The string to check
String.explode
Split a string into its Unicode characters.
String.implode
Create a string from an array of characters.
String.slice
Get a substring of the input string starting at from
up to (but not including) to
.
Parameters:
- from: The index where the substring should begin
- to: The index where the substring should end (not including the character at
to
) - input: The input string
Returns the substring. If from
or to
is negative, it is treated as an offset from the end of the input string, i.e. the index plus the length of the string.
String.contains
Check if a string contains a substring.
Parameters:
- substring: The substring to find
- input: The input string
String.startsWith
Check if a string begins with another string.
Parameters:
- substring: The substring to match at the beginning of the input string
- input: The input string
String.endsWith
Check if a string ends with another string.
Parameters:
- substring: The substring to match at the end of the input string
- input: The input string