String.Remove方法注意事项:
1、该方法不改变元字符串;
2、str = ‘’; str.Remove(str.Length-3);明显超限,但是不报错,返回值为'';
str = '1234'; str.Remove(str.Length-5);明显超限,不报错,返回‘1234’;
也就是说,超出字符串个数的去除,Remove方法不会报错,但是会原封不动的返回元字符串;
String.Remove方法注意事项:
1、该方法不改变元字符串;
2、str = ‘’; str.Remove(str.Length-3);明显超限,但是不报错,返回值为'';
str = '1234'; str.Remove(str.Length-5);明显超限,不报错,返回‘1234’;
也就是说,超出字符串个数的去除,Remove方法不会报错,但是会原封不动的返回元字符串;
转载于:https://www.cnblogs.com/terony/p/3481645.html