某指数串c#后,怎样得到的一切 [英] How do I get everything after a certain index in string c#
本文介绍了某指数串c#后,怎样得到的一切的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以说我有字符串:
MyNamespace.SubNameSpace.MyClassName
"MyNamespace.SubNameSpace.MyClassName"
我如何提取最后一期后刚刚的一切,MyClassName
How do I extract just everything after the last period, "MyClassName"
推荐答案
使用 String.Substring 和 String.LastIndexOf 方法
Use String.Substring and String.LastIndexOf methods.
string str = "MyNamespace.SubNameSpace.MyClassName";
string str1 = str.Substring(str.LastIndexOf('.') + 1);
这篇关于某指数串c#后,怎样得到的一切的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文