Browse Source

Update ToUnderLine

pull/23/head
sunkaixuan 2 years ago
parent
commit
541b5df8cd
  1. 11
      Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

11
Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs

@ -17,9 +17,16 @@ namespace SqlSugar
{
public class UtilMethods
{
public static string ToUnderLine(string str)
public static string ToUnderLine(string str, bool isToUpper = false)
{
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
if (isToUpper)
{
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToUpper();
}
else
{
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}
internal static bool IsJsonMember(Expression expression, SqlSugarProvider context)

Loading…
Cancel
Save