Javascriptstring properties and Methods
Eg:var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var sln = txt.length;
String properties
Properties |
Description |
Constructor |
Returns a function that creates a string property |
Length |
Returns the length of a string |
Prototype |
Allows you to add properties and methods to an object |
String method
Method |
Description |
CharAt () |
Returns the character of the specified index position |
charCodeAt () |
Returns the Unicode value of the specified index position character |
Concat () |
Concatenate two or more strings, returning the concatenated string |
fromCharCode () |
Convert Unicode to a string |
IndexOf () |
Retrieves the position of the first occurrence of the specified character in a string |
LastIndexOf () |
Retrieves the position of the last occurrence of the specified character in a string |
Localecompare () |
Compare two strings in a local-specific order |
Match () |
Found a match for one or more regular expressions |
Replace () |
To replace a substring that matches a regular expression |
Search () |
Retrieving a value that matches a regular expression |
Slice () |
Extracts a fragment of a string and returns the extracted part in a new string |
Split () |
To split a string into a substring array |
SUBSTR () |
Extracts a specified number of characters from the starting index number in a string |
SUBSTRING () |
Extracts the characters between two specified index numbers in a string |
toLocaleLowerCase () |
Converts a string to lowercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mapping |
toLocaleUpperCase () |
Converts a string to uppercase based on the host's locale, with only a few languages (such as Turkish) with a local case-specific mapping |
toLowerCase () |
Convert a string to lowercase |
ToString () |
Returns the String object value |
toUpperCase () |
Convert a string to uppercase |
Trim () |
Remove string end and end blanks |
ValueOf () |
Returns the original value of a string object |
JavaScript Daily Learning 5