比如想得到字符串string strRaw="where ('ssss'>1)"中‘.’的后面部分"ssss'>1)"
代码如下:
string strRaw="Mathematics.Operation";
string strNew=string.Empty;
//先求出指定字符的位置
int i=strRaw.LastIndexOf('(');
//指定位置截取
StrNew=strRaw.Substring(i+1);
本文介绍如何使用C#中的`LastIndexOf`和`Substring`方法从给定字符串`stringstrRaw`(如Mathematics.Operation)中提取.后的部分,如ssss>1。
比如想得到字符串string strRaw="where ('ssss'>1)"中‘.’的后面部分"ssss'>1)"
代码如下:
string strRaw="Mathematics.Operation";
string strNew=string.Empty;
//先求出指定字符的位置
int i=strRaw.LastIndexOf('(');
//指定位置截取
StrNew=strRaw.Substring(i+1);

被折叠的 条评论
为什么被折叠?