using System; using System.Globalization; using System.Linq; namespace LeafWeb.Core.Utility { public static class StringExtensions { public static string SplitCamelCase(this string str) { return str.Aggregate( string.Empty, (current, c) => current + (char.IsUpper(c) && current.Length > 0 ? " " + c : c.ToString(CultureInfo.InvariantCulture))); } public static string LowercaseFirst(string s) { // Check for empty string. if (string.IsNullOrEmpty(s)) { return string.Empty; } // Return char and concat substring. return char.ToLowerInvariant(s[0]) + s.Substring(1); } } }