mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Update ToUnderLine
This commit is contained in:
parent
eb4a0255e7
commit
0532cd246b
@ -19,7 +19,11 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public static string ToUnderLine(string str, bool isToUpper = false)
|
public static string ToUnderLine(string str, bool isToUpper = false)
|
||||||
{
|
{
|
||||||
if (isToUpper)
|
if (str == null || str.Contains("_"))
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
else if (isToUpper)
|
||||||
{
|
{
|
||||||
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToUpper();
|
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToUpper();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user