Angular Certification Training
- 13k Enrolled Learners
- Live Class
Some of the most used string manipulation functions are the following:
Used to find the length of any particular string.
Finding string in a string:
Indexof() can be used to locate any particular string in and other string.
lastIndexOf() returns the last occurrence of any particular string in a string.
This method is used for getting a part of a string.
It takes on two parameters, starts and end for the output and returns the values according to that.
This function takes on two parameters, the one which is to be replaced and the other which will replace the first parameter in the string.
This function converts the whole string to the upper case.
This function concatenates the two parameters which are passed on.
This function removes all the white spaces from the string which are present either in the start or the end of the string.
This function converts a string into an array.
The length property of a String object indicates the length of a string, in UTF-16 code units.
var str = 'Life, the universe and everything. Answer:'; console.log(str + ' ' + str.length);
The above variable “str” which is of var type has a string stored in it.
In the console.log function, the str.length would return the length of the string stored in the str variable.
42 is returned as the answer as 42 is the length of the string.
Check out the Web Development Certification Training by Edureka. Web Development Certification Training will help you learn how to create impressive websites using HTML5, CSS3, Twitter Bootstrap 3, jQuery and Google APIs and deploy it to Amazon Simple Storage Service(S3).