String object in JavaScript
The String object helps you work with a series of characters; It helps handle the original string data types in JavaScript with some help methods.
When JavaScript automatically changes between the original string and String objects, you can call any help method of the String object on an original string.
Syntax
Use the following syntax to create a String object:
var val = new String ( string );
The string parameter is a sequence of characters that has been correctly encoded.
Properties of String
Below is a list of properties of the String object and its description.
Properties Descriptionconstructor
Returns a reference to the String function that creates that objectlength
Returns the length of the stringprototype
The prototype property allows you to add properties and methods to an object.Methods of String
Below is a list of available methods in the String object with its description.
Method DescriptioncharAt ()
Returns the character at the index (index) specifiedcharCodeAt ()
Returns a number indicating the Unicode value of the character in the given indexconcat ()
match the text of the two strings and return a new stringindexOf ()
Returns the index in the String object calling the first occurrence of the specified value, or -1 if not foundlastIndexOf ()
Returns the index in the String object calling of the last occurrence of the specified value, or -1 if not foundlocaleCompare ()
Returns an indication whether or not a string refers to before or after, or is the same as the given string in the sort ordermatch ()
Used to match a Regular Expression with a stringreplace ()
Used to find a match between a given Regular Expression and a string, and to replace a substring that matches a new substring.search ()
Execute the search for a match between a regular expression and a specified stringslice ()
Extract an area of a string and return a new stringsplit ()
Divide a String object into an array of strings by dividing the string into sub-stringssubstr ()
Returns the characters in a string starting at the specified position with a specified number of characterssubstring ()
Returns characters in a string between two indexes within the stringtoLocaleLowerCase ()
The characters inside a string are converted into lowercase while respecting the current LocaletoLocaleUpperCase ()
The characters inside a string are transformed into floral typefaces while respecting the current LocaletoLowerCase ()
Returns the value of the calling string being converted to lower casetoString ()
Returns a string representing the specified objecttoUpperCase ()
Returns the value of the calling string being converted to uppercasevalueOf ()
Returns the original value of the specified objectString HTML Wrappers
Below is a list of methods that return a copy of the string wrapped within an appropriate HTML tag.
Method Descriptionanchor ()
Create an Anchor HTML that is used as a hypertext target (hypertext target)big ()
Create a string to be displayed in a big font as if it were in a tagblink ()
Create a flashing sequence as if it were in a cardbold ()
Create a string to be displayed in bold form as if it were in a tagfixed ()
Create a string to be displayed in a fixed font as if it were in a tagfontcolor ()
Create a string to be displayed in a fixed color as if it were in a tagfontsize ()
Making a string is displayed in a font size defined as when it is in a tagitalics ()
Make a string in italic format as if it were in a cardlink ()
Create an HTML hypertext link that requires another URLsmall ()
Make a string displayed in Small font format as if it were in a tagstrike ()
Make a string displayed in the form of dashed text as if it were in a tagsub ()
Make a string displayed in the form of the lower index as if it were in a tagsup ()
Make a string displayed in the form of the upper index as if it were in a tagAccording to Tutorialspoint
Previous article: Boolean object in JavaScript
Next post: Array (Array) in JavaScript
You should read it
- String (String) in C #
- Boolean objects in JavaScript
- String (String) in PHP
- String (String) in C / C ++
- string.h in C
- Learn about ES6 in Javascript
- Learn about Collection of Record in JavaScript
- Syntax of JavaScript
- Some ways to tie the pole or everyone should know
- What is JavaScript?
- What is JavaScript? Can the Internet exist without JavaScript?
- For ... loop in JavaScript
Maybe you are interested
Summary of functions that handle character strings in Excel, syntax and examples
The computer now finalizes the string, solving it in a flash
Write a program to reverse a string in Python
How to insert characters at the beginning or end of a string in Excel
How to separate text strings by commas or spaces in Excel
Instructions for cutting strings, concatenating strings in Excel