function of fetching substring substring () __ function
Source: Internet
Author: User
SUBSTRING (int index) starts with index Word to the last (string starts counting from 0)
substring (int beginindex, int endindex) starts with the index Word to Endindex (string is counted from 0, this does not include the first endindex character) substring
The public string substring (int beginindex) returns a new string, which is a substring of this string. The substring begins at the specified index at the end of the string.
For example:
Parameters:
Beginindex-Index at the beginning (including).
Return:
The specified substring.
Thrown:
Indexoutofboundsexception-if beginindex is negative or greater than the length of this String object.
Substring
public string substring (int beginindex, int endindex) returns a new string, which is a substring of this string. The substring starts at the specified Beginindex and continues to the character at the index endIndex-1. Therefore, the length of the substring is endindex-beginindex.
Example:
Parameters:
Beginindex-Index at the beginning (including).
Endindex-the index at the end (not included).
Return:
The specified substring.
Thrown:
Indexoutofboundsexception-If Beginindex is negative, or endindex is greater than the length of this String object, or Beginindex is greater than endindex.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.