C# 截取字符串某个字符分割的最后一部分

例如 string s1="123.456.789",想截取得到的新字符串为“789”

代码如下:

            string s1 = "123.456.789";
            string s2 = string.Empty;
            //先求出最后出现这个字符的下标
            int index = s1.LastIndexOf('.');
            //从下一个索引开始截取
            s2=s1.Substring(index+1);
            Console.WriteLine(s2);
            Console.ReadLine();
原文地址:https://www.cnblogs.com/527289276qq/p/5283486.html