mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 11:26:34 +00:00
structure app by rest api standards
add getusers tidy up BusinessException
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Azaion.Common.Extensions;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string ToSnakeCase(this string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return text;
|
||||
|
||||
if (text.Length < 2)
|
||||
return text.ToLowerInvariant();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(char.ToLowerInvariant(text[0]));
|
||||
for (int i = 1; i < text.Length; ++i) {
|
||||
var c = text[i];
|
||||
if(char.IsUpper(c)) {
|
||||
sb.Append('_');
|
||||
sb.Append(char.ToLowerInvariant(c));
|
||||
} else {
|
||||
sb.Append(c);
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user