Substring usage in Asp.net

Source: Internet
Author: User
Substring
Public string substring (INT beginindex) returns a new string, which is a substring of this string. The substring starts with a character at the specified index until the end of the string.
For example:

"Unhappy". substring (2) returns "happy"
"Harbison". substring (3) returns "bison"
"Emptiness". substring (9) returns "" (an empty string)

Parameters:
Beginindex-the index at the beginning (including ).
Return Value:
The specified substring.
Throw:
Indexoutofboundsexception-If beginindex is negative or longer 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 from the specified beginindex and ends with the index endindex-1. Therefore, the length of the substring is endindex-beginindex.
Example:

"Hamburger". substring (4, 8) returns "urge"
"Smiles". substring (1, 5) returns "Mile"

Parameters:
Beginindex-the index at the beginning (including ).
Endindex-the index at the end (not included ).
Return Value:
The specified substring.
Throw:
Indexoutofboundsexception-If inindex is negative, endindex is greater than the length of this string object, or beginindex is greater than endindex.

In C #, substring () has two overload functions.
Substring (int A) is used the same as above.
Substring (int A, int B) the length of the truncated string.

I do not know which syntax is used for the string above.

For C #

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.