17 lines
508 B
C#
17 lines
508 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Json2CSharpCodeGenerator.Lib;
|
|
|
|
public static class StringExtension
|
|
{
|
|
public static string ToCamelCase(this string str)
|
|
{
|
|
if (!string.IsNullOrEmpty(str) && str.Length > 1)
|
|
{
|
|
return char.ToLowerInvariant(str[0]) + str.Substring(1);
|
|
}
|
|
return str.ToLowerInvariant();
|
|
}
|
|
|
|
public static string RemoveSpecialCharacters(this string str) => Regex.Replace(str, "[^a-zA-Z0-9]+", "", RegexOptions.Compiled);
|
|
} |