Пример #1
0
        public string CleanUpProperty(string property, bool capitalize, PropertyModifications mods)
        {
            string pattern = @"[_\/\.\s()-]";
            Regex  regex   = new Regex(pattern, RegexOptions.IgnoreCase);

            switch (mods)
            {
            case PropertyModifications.Compress:
                property = regex.Replace(property, "");
                break;

            case PropertyModifications.Underscore:
                property = regex.Replace(property, "_");
                break;

            default:
                break;
            }

            if (capitalize)
            {
                property = StringFormatter.PascalCasing(property);
            }
            return(property);
        }
Пример #2
0
        public string CleanUpProperty(string property, bool capitalize, PropertyModifications mods)
        {
            string pattern = @"[_\/\.\s()-]";
            Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);

            switch (mods)
            {
                case PropertyModifications.Compress:
                    property = regex.Replace(property, "");
                    break;
                case PropertyModifications.Underscore:
                    property = regex.Replace(property, "_");
                    break;
                default:
                    break;
            }

            if (capitalize)
            {
                property = StringFormatter.PascalCasing(property);
            }
            return property;
        }