首页 > 其他分享 >String.Remove()、String.Substring()

String.Remove()、String.Substring()

时间:2022-11-13 22:23:04浏览次数:42  
标签:String int Remove Substring startIndex 字符串

https://blog.csdn.net/n_moling/article/details/78953658

Remove(int startIndex):

删除此字符串中从指定位置到最后位置的所有字符。

Remove(int startIndex, int length):

从此实例中的指定位置开始删除指定数目的字符。

Substring(int startIndex):

从此实例检索子字符串。子字符串从指定的字符位置开始。

Substring(int startIndex, int length):

从此实例检索子字符串。子字符串从指定的字符位置开始且具有指定的长度。

 

两种方法各有优劣,一个删除,一个获取,根据需求选取更合适的方法。
————————————————
版权声明:本文为CSDN博主「末零」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/n_moling/article/details/78953658

标签:String,int,Remove,Substring,startIndex,字符串
From: https://www.cnblogs.com/Dongmy/p/16887183.html

相关文章