Question

Disons que j'ai la chaîne:

"MyNamespace.SubNameSpace.MyClassName"

Comment puis-je extraire juste tout après la dernière période, « MyClassName »

Était-ce utile?

La solution

Utilisez String.substring String.LastIndexOf méthodes.

string str = "MyNamespace.SubNameSpace.MyClassName";
string str1 = str.Substring(str.LastIndexOf('.') + 1);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top