美文网首页
C# 截取字符串指定字符的后面部分

C# 截取字符串指定字符的后面部分

作者: 堆石成山 | 来源:发表于2019-06-27 10:29 被阅读0次

比如想得到字符串string strRaw="Mathematics.Operation"中‘.’的后面部分"Operation"

代码如下:

string strRaw="Mathematics.Operation";

string strNew=string.Empty;

//先求出指定字符的位置

int i=strRaw.LastIndexOf('.');

//指定位置截取

StrNew=strRaw.Substring(i+1);

相关文章

网友评论

      本文标题:C# 截取字符串指定字符的后面部分

      本文链接:https://www.haomeiwen.com/subject/tvdlcctx.html