Update ToUnderLine

This commit is contained in:
sunkaixuan
2022-10-22 23:33:53 +08:00
parent acf2888aa1
commit 541b5df8cd

View File

@@ -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)