Splitting CamelCase

前端 未结 15 2491
盖世英雄少女心
盖世英雄少女心 2020-12-07 10:56

This is all asp.net c#.

I have an enum

public enum ControlSelectionType 
{
    NotApplicable = 1,
    SingleSelectRadioButtons = 2,
    SingleSelectD         


        
15条回答
  •  长情又很酷
    2020-12-07 11:32

    I also have an enum which I had to separate. In my case this method solved the problem-

    string SeparateCamelCase(string str)
    {
        for (int i = 1; i < str.Length; i++)
        {
            if (char.IsUpper(str[i]))
            {
                str = str.Insert(i, " ");
                i++;
            }
        }
        return str;
    }
    

提交回复
热议问题