String knowledge Summary

1. Create a string
     var name = '**'; // string in quotes are
     var str = new String ( '**'); // creates a String object
     Ascll code string comparison (with line conversion)
 
2. Get unicode string transcoding
charAt () Returns the position of character
charCodeAt () Returns the unicode character code location
the fromCharCode () to convert the Unicode code numbers or other
 
 3. string concatenation
concat () string concatenation 
 + Sign is to be noted "double quotes" and 'single quotation marks' nested problem
 
4. Find whether the method exists
indexOf () to find the location index for the first time, can not be found or -1
lastIndexOf () to find the location of the last occurrence, or -1 not found
includes () to find out whether there is a value, returns true presence, absence, return false; (ie not supported) [unique string]
 
The string taken
trim () clear space removal string (common)
split ( '@') left and right array is divided into strings @ 
 
slice (a, b) intercept, a and b are strings subscript a may be provided which comprises a negative b Excluding
subString (a, b), taken from a beginning to the end b, wherein A comprises a can not be negative b Excluding
substr (a, b), taken from a start number of characters b 
Difference 6.slice () subString () and substr () of
    a. slice is received and substring starting position and an end position (the end position is not included), and is received substr starting position and length of the string to be returned
    b. When the received parameter is negative,
    slice will be the negative of its length corresponding to the sum of the string, as a result of the parameter;
    substr is simply the result of the first parameter and adding the length of the string as the first parameter;
    negative substring is simply directly convert both 0;
    c.substring two parameters is a smaller as the start position, end position as a parameter with
 
7 .. string detected
startsWith () determines whether the current string to the beginning of another string (returns true or false)
endsWidth () determines whether the end of the current string to another string
 
8. Case conversion
toLowerCase () lowercase letters
toUpperCase () uppercase letters
 
 
 
     
 

Guess you like

Origin www.cnblogs.com/GreenRadish/p/11122665.html