Tag: Script Dex indicates that the function length is visible string character bis
Substring
1.public String substring (int beginindex).
Returns a new string that is a substring of this string. The substring starts at the specified index and continues to the end of the string.
Parameters:
Beginindex-the index (including) at the beginning.
Return:
The specified substring.
For example:
"Unhappy". SUBSTRING (2) returns "Happy"
"Harbison". SUBSTRING (3) returns "Bison"
"Emptiness". SUBSTRING (9) returns "" (An empty string)
2.public String substring (int beginindex,int length).
Returns a new string that is a substring of this string. The substring starts at the specified beginindex, and length: Indicates the length of the substring.
Parameters:
Beginindex-the index (including) at the beginning.
Endindex at the end of the index (not included).
Return:
The specified substring.
Example:
"Hamburger". Substring (4,8) returns "Urge"
"Smiles". Substring (1,5) returns "Mile"
3.
<script type= "Text/javascript" >
var str= "Hello world!" document.write (str.substring (1,3));
</script>
The above returns a string: "ell"; Str.substring (+)//return E
Str.substring (1)//Return to "Ello World";
There is also a strange phenomenon in this function, when str.substring (5,0) occurs; This is what happened, but the return is "Hello", str.substring (5,1)//Return "Ello", cut the first bit, return the rest.
Visible substring (start,end), can have different instructions, that is, start can be the length to return, end is the number of characters to be removed (starting from the first).
In JS, substr (start,length), the use of more convenient.
Usage of substring in Java