C#字符串替换--将字符串中所有的‘,’替换成‘_’

class Program
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();
        if (str.IndexOf(",") != -1)
        {
            str = str.Replace(",", "_");
        }
        Console.WriteLine("替换后的字符串为:" + str);
    }
}

 

posted @ 2019-12-23 10:12  highlightyys  阅读(70)  评论(0)    收藏  举报