예제 #1
0
        public static IEnumerable <string> Split(string compoundString, CompoundWordCase fromCase,
                                                 WordCase toCase = WordCase.Any)
        {
            if (string.IsNullOrEmpty(compoundString))
            {
                return(Enumerable.Empty <string>());
            }

            if (fromCase.HasSeparator)
            {
                return(compoundString.Split(new[] { fromCase.Separator }, StringSplitOptions.RemoveEmptyEntries)
                       .Select(s => s.ToCase(toCase)));
            }
            if (fromCase.Case == WordCase.TitleCase)
            {
                return(SplitOnTitleCase(compoundString)
                       .Select(s => s.ToCase(toCase)));
            }
            return(new[] { compoundString.ToCase(toCase) });
        }
예제 #2
0
 public static string ToCase(this string str, WordCase wordCase)
 => CompoundWordCase.ToCase(str, wordCase);