Welcome Guest! (App Version 3.1)

websitnero logo name

String Methods

String Methods in JS

String Library provides many features for String Manipulation of the various string data types in JavaScript. Have a look at the following table:

String Library Methods
S.No.NameDescriptionExamplesReference
1charAt()Returns the character at a certain index in string
2charCodeAt()Returns ASCII code if a character at a certain index in string
3concat()Returns addition of 2 strings
4endsWith()Checks if a string ends with a certain character or word
5fromCharCode()Returns string after converting UTF-16 code units into keyboard characters
6includes() Checks if string includes certain characters or words
7indexOf()Returns index of character which matches entered character or string
8lastIndexOf()Returns last index of entered character or string if it is present in string which is being checked
9localeCompare()It compares two strings in the current locale and returns -1, 0, 1 based on result. The locale is based on the language settings of the current browser.
10match()Returns the matched values in a string to a character or word
11repeat()Returns a string with original string repeated a certain number of times.
12replace()Returns a new string with set of words in orinal string replaced by new charaters or words.
13search()Returns the index of character in original string where the searched word starts (if present), else it retunrs -1.
14slice()Returns a new string out of Original String depending on the parameters passed.
15split()Returns an array after splitting a string into set of substrings based on parameter passed.
16startsWith()Returns boolean depicting whether the string starts with a certain substring or not
17substr()Returns a part of the original string depending on parameters passed.
18substring()Returns a part of the original string depending on parameters passed.
19toLocaleLowerCase()Converts a string to lowercase letters, according to the host's current locale which is based on the language settings of the current browser.
20toLocaleUpperCase()Converts a string to uppercase letters, according to the host's current locale which is based on the language settings of the current browser.
21toLowerCase()Converts a string to lowercase
22toUpperCase()Converts a string to uppercase
23toString()Converts a variable type to string. In case of string variable, there is no change to variable.
24trim()Removes blank spaces to each end of a string.
25valueOf()Returns value of a variable.
Further Reading

1. String Object in JavaScript

WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.