문제

Lets say I have the string:

"MyNamespace.SubNameSpace.MyClassName"

How do I extract just everything after the last period, "MyClassName"

도움이 되었습니까?

해결책

Use String.Substring and String.LastIndexOf methods.

string str = "MyNamespace.SubNameSpace.MyClassName";
string str1 = str.Substring(str.LastIndexOf('.') + 1);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top