JavaScript string Object
First, the attribute
1.length
Calculates the length of a string (not distinguished between Chinese and English)
2.constructor
The constructor of the object
Get type
1. String object. charAt (num)
Returns the character at the specified position.
2. String object. charCodeAt (num)
Returns the Unicode encoding of the character at the specified position
3. String.fromCharCode ()
Accepts one or more specified Unicode values, and then returns one or more
String. It cannot be used as a method of a String object that you have created.
Find type
1. String object. IndexOf ("")
Returns the position of the first occurrence of a specified string in a String object
2. String object. LastIndexOf ()
Returns the location of the last occurrence of the specified string value
3. String object. Match ()
Retrieves the specified value in a string, the value returned is the specified value
4. String object. replace (target value, replacement value)
Replace some characters in a string with some other characters
Interception type
1. String object. Slice (start,end)
All strings from the specified start position to the end position (not included). If you do not specify an end position,
From the specified start position, the end is taken
The slice parameter can be a negative number, or, in the case of a negative number, the end of the string, starting with 1.
2. String object. substr (Start,length)
Takes a string of the specified length from the specified position. If no length is specified, the start of the specified
The position is taken to the end.
Conversion type
1. String object. Split ()
To split a string into an array
2. String object. toLowerCase ();
Used to convert a string to lowercase.
3. String object. toUpperCase ()
Convert a string to uppercase
JavaScript string Object