The String type provides a variety of methods for string manipulation and analysis.
Checks if the string is empty.
Return Type: Boolean
Example:
Converts all characters in the string to uppercase.
Return Type: String
Example:
Converts all characters in the string to lowercase.
Return Type: String
Example:
Removes whitespace from both ends of the string.
Return Type: String
Example:
Removes whitespace from the start of the string.
Return Type: String
Example:
Removes whitespace from the end of the string.
Return Type: String
Example:
Checks if the string contains the specified substring.
Parameters:
substr: The substring to search for.Return Type: Boolean
Example:
Checks if the string starts with the specified prefix.
Parameters:
prefix: The prefix to check.Return Type: Boolean
Example:
Checks if the string ends with the specified suffix.
Parameters:
suffix: The suffix to check.Return Type: Boolean
Example:
Finds the index of the first occurrence of the substring, starting from the specified position.
Parameters:
substr: The substring to search for.start: The position to start the search from (optional).Return Type: Number
Example:
Finds the index of the last occurrence of the substring.
Parameters:
substr: The substring to search for.Return Type: Number
Example:
Extracts a substring from the string, starting and ending at the specified indices.
Parameters:
start: The starting index.end: The ending index (optional).Return Type: String
Example:
Extracts a section of the string and returns it as a new string, without modifying the original string.
Parameters:
start: The starting index.end: The ending index (optional).Return Type: String
Example:
Splits the string into an array of substrings using the specified delimiter.
Parameters:
delimiter: The delimiter to split the string by.Return Type: Array<String>
Example:
Joins an array of strings into a single string, with the original string as the separator.
Parameters:
array: The array of strings to join.Return Type: String
Example:
Checks if the string matches the specified regular expression pattern.
Parameters:
pattern: The regex pattern to match.Return Type: Boolean
Example:
Replaces occurrences of the regex pattern with the replacement string.
Parameters:
pattern: The regex pattern to replace.replacement: The string to replace matches with.Return Type: String
Example:
Repeats the string the specified number of times.
Parameters:
count: The number of times to repeat the string.Return Type: String
Example:
Reverses the characters in the string.
Return Type: String
Example:
Replaces occurrences of a substring with another substring.
Parameters:
from: The substring to replace.to: The substring to replace with.Return Type: String
Example: