Let's get started:
1. String length
length property is one of the properties you will probably use in strings. It returns the length of the string.
2. Convert to Lowercase
toLowerCase method returns the lowercase version of the string.
3. Convert to Uppercase
toUpperCase method returns the uppercase version of the string.
4. startsWith method
startsWith method returns whether the string starts with the provided string.
5. endsWith method
endsWith method returns whether the string ends with the provided string.
6. includes method
includes method checks whether a string contains the specified string/characters.
7. charAt method
charAt method Returns the character at the specified index (position).
8. concat method
concat method joins two or more strings and returns a new joined strings.
9. repeat method
repeat method Returns a new string with a specified number of copies of an existing string.
10. slice method
slice method extracts a part of a string and returns a new string.
11. replace method
replace method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
12. split method
split method is used to split a string into an array of substrings and return the new array. If an empty string is used as the separator, the string is split between each character.
13. trim method
trim method removes whitespaces from both ends of the string. It does not change the original string.
14. substr method
substr method gets a substring beginning at the specified location and having the specified length.
15. substring method
substring method extracts the characters from a string, between two specified indices, and returns the new substring. It does not include the end index.
These are some basic string methods you should know. I promise you will need them sometime.
Did you find it helpful? You can find me on Twitter. Have a nice day!😍😍