> 其他 >
subString 在C#中的作用是什么
人气:309 ℃ 时间:2020-02-03 00:00:26
解答
从此实例检索子字符串.子字符串从指定的字符位置开始且具有指定的长度.
public string Substring(
int startIndex,
int length
)
参数
startIndex
类型: System ..::.Int32
此实例中子字符串的起始字符位置(从零开始).
length
类型: System ..::.Int32
子字符串中的字符数.
String str1 = "abcdefg";
str1.Substring(2,3); //返回从第3个字符开始的长度为3的子字符串,结果是字符串"cde"
推荐
猜你喜欢
© 2026 79432.Com All Rights Reserved.
电脑版|手机版