This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17724|Reply: 0

[Communication] C# subString understanding

[Copy link]
Posted on 1/31/2019 4:41:51 PM | | |
Consider the first parameter of subString(index, length) as the index starting from 1, and truncate all the previous characters at the index position, and the length represents the length of the field from the index position, and if the length is not specified, the field is intercepted to the end of the string.

The maximum length of the length is str.length-index!

--sql server
SUBSTRING(str,start,length): represents the str data source, the str count position starts from 1 by default, and the intercepted field is the length character starting from start (including start); The string intercepts the character from start to start+length-1, and if the starting position is 0, or less than 0, it completes and then intercepts the length

Instance:








Previous:The difference between C# Linq First and FirstOrDefault
Next:C# Remove string prefix specified characters String.Trim()
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com