Convert String To camelCase from TitleCase C#

后端 未结 11 1516

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:53

    You just need to lower the first char in the array. See this answer

    Char.ToLowerInvariant(name[0]) + name.Substring(1)
    

    As a side note, seeing as you are removing spaces you can replace the underscore with an empty string.

    .Replace("_", string.Empty)
    

提交回复
热议问题