11
나는 TextInfo.ToTitleCase로 변환 한 문자열을 가지고 있으며 밑줄을 제거하고 함께 문자열을 결합했습니다. 이제 문자열의 첫 번째 문자 만 소문자로 변경해야하며 어떤 이유로 든이를 수행하는 방법을 알 수 없습니다. 도움에 미리 감사드립니다.String to CamelCase from TitleCase C#
class Program
{
static void Main(string[] args)
{
string functionName = "zebulans_nightmare";
TextInfo txtInfo = new CultureInfo("en-us", false).TextInfo;
functionName = txtInfo.ToTitleCase(functionName).Replace('_', ' ').Replace(" ", String.Empty);
Console.Out.WriteLine(functionName);
Console.ReadLine();
}
}
결과 : ZebulansNightmare
원하는 결과 zebulansNightmare는
는 UPDATE :
class Program
{
static void Main(string[] args)
{
string functionName = "zebulans_nightmare";
TextInfo txtInfo = new CultureInfo("en-us", false).TextInfo;
functionName = txtInfo.ToTitleCase(functionName).Replace("_", string.Empty).Replace(" ", string.Empty);
functionName = $"{functionName.First().ToString().ToLowerInvariant()}{functionName.Substring(1)}";
Console.Out.WriteLine(functionName);
Console.ReadLine();
}
}
는
감사합니다. –
전화하세요. 조정을하고 질문을 업데이트했습니다. –