Comment puis-je obtenir tout après un certain indice dans la chaîne c #
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 »
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