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
May be interested
- Object Number in JavaScriptthe number object represents the date in the form of a numeric value, or an integer or floating-point number. generally, you don't need to worry about number objects because the browser automatically converts number literals to illustrate the number classes.
- Basic about jQuerythis article will explain the basic concepts commonly used in jquery such as: string (string), number (number), boolean, array (array), function, parameter, context, ...
- Syntax of JavaScriptjavascript can be implemented using javascript commands that are placed in html tags ... in a web page.
- String (String) in PHPstring is a sequence of characters, you will find available string handling functions in php at php string (string) handler
- String (String) in C / C ++this form of string originates from c language and continues to be supported in c / c ++. the string in the c programming language is essentially a one-dimensional array of characters that ends with a null character ''.
- Print pages in JavaScriptmany times you will love to put a button on your website to print the content of that page through a printer. javascript helps you perform this function by using the print function of the window object.
- How to turn on and turn off Javascript on Firefox, Chromejavascript is an object-based scripting language that often creates eye-catching effects on websites.however, if you need to turn on or off javascript, the following article will guide you to do that.
- string.h in Cthe file header named string.h in c library defines a variable type, a macro and various functions to manipulate character arrays.
- Regular Expression and RegExp in JavaScripta regular expression is an object that describes a pattern of characters.
- Array (Array) in JavaScriptarray object - array helps you store multiple values in a single variable. it stores a set of fixed-size ranges of elements in the same type (type). an array is used to store a data set, but it is often more useful to think of an array as a collection of variables in the same type.