Come faccio ad avere tutto dopo un determinato indice nella stringa c #
Domanda
Diciamo che ho la stringa:
"MyNamespace.SubNameSpace.MyClassName"
Come faccio a estrarre proprio tutto dopo l'ultimo periodo, "MyClassName"
Soluzione
Usa String.Substring e String.LastIndexOf metodi.
string str = "MyNamespace.SubNameSpace.MyClassName";
string str1 = str.Substring(str.LastIndexOf('.') + 1);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow