Get the length of a string, spaces and all. Doesn’t count just letters, it goes the inclusive route and counts them all!
Removes the whitespace at the beginning and end of a string. Not the white space between characters!
Returns a true or false value if a string contains a substring.
Get the string index (starting from 0) of where a substring first occurs in a longer string. If the substring isn’t there, it returns -1.
.toUpperCase() & .toLowerCase()
These respective functions turn a string to all lowercase and uppercase letters. Pretty self-explanatory.
There’s no included method for capitalizing a string, but you can make a function to do this instead. Several string methods used here are explained further on.
Self-explanatory too, it replaces the first instance of a substring with another one. If you want to replace all instances, the string will need to be put within the global regex like this: /<substring>/b.
Slice takes a substring out of a string, cutting it out by specifying the starting and ending indexes.
If you only specify the starting index, the substring will start from there and end at the end of the string
If you include the start and end index, the substring will be contained within those two
You can use a negative number to count the index, starting from the end of the string
Just using -1 gives the last character in the string
Turns a string into an array by breaking it apart by the specificied substring. Using an empty string, or '', breaks the string apart by each character (including spaces).
Takes a string and copies it a set number of times into a new string. Best used with .trim() to remove leftover white space.
Checks to see if a substring is matched in a string, and returns the matched string. The matches, one or more, are returned in an array that you can count.
Using a regex lets you look for multiple matches and see the specific ones in the array.
Gets the string character at a specific index. Will only accept positive numbers, can’t use negative ones to start from the end.