Convert String To camelCase from TitleCase C#

后端 未结 11 1520

I have a string that I converted to a TextInfo.ToTitleCase and removed the underscores and joined the string together. Now I need to change the first and only the first charact

11条回答
  •  不思量自难忘°
    2021-02-04 23:31

    public static string CamelCase(this string str)  
        {  
          TextInfo cultInfo = new CultureInfo("en-US", false).TextInfo;
          str = cultInfo.ToTitleCase(str);
          str = str.Replace(" ", "");
          return str;
        }
    

    This should work using System.Globalization

提交回复
热议问题