using System;using System.Text.RegularExpressions;publicclassKata{
publicstaticstringToCamelCase(string str){
return Regex.Replace(str,@"[_-](\w)", m => m.Groups[1].Value.ToUpper());}}
答案2:
using System;using System.Linq;publicclassKata{
publicstaticstringToCamelCase(string str){
returnstring.Concat(str.Split('-','_').Select((s, i)=> i >0?char.ToUpper(s[0])+ s.Substring(1): s));}}
答案3:
using System;using System.Text;publicclassKata{
publicstaticstringToCamelCase(string str){
var sb =newStringBuilder();for(int i =0; i < str.Length; i++){
if(str[i]!='-'&& str[i]!='_') sb.Append(str[i]);else sb.Append(char.ToUpper(str[++i]