且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从TitleCase C#将字符串转换为camelCase

更新时间:2023-02-12 18:04:37

您只需要降低数组中的第一个字符.参见此 answer

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)