/// <summary></summary> public static string TransformText(string value, TextTransformationOption option) { if (value.Length > 0) { var dictionary = new Dictionary<TextTransformationOption, Func<string, string>>(); dictionary.Add(TextTransformationOption.CamelCase, ToCamel); dictionary.Add(TextTransformationOption.PascalCase, ToPascal); dictionary.Add(TextTransformationOption.Underscored, ToUnderscored); value = dictionary[option](value); } return value; }
/// <summary></summary> bool ChangeSelectedTextCase(TextSelection selection, TextTransformationOption option) { string before = selection.Text; string after = CodeManager.TransformText(before, option); bool changed = (before != after); if (changed) { selection.Delete(); selection.Insert(after); } return changed; }