Added new node manager. Added new login/register screen. AuditLog. Permissions
This commit is contained in:
33
Moonlight/App/Helpers/StringHelper.cs
Normal file
33
Moonlight/App/Helpers/StringHelper.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Moonlight.App.Helpers;
|
||||
|
||||
public static class StringHelper
|
||||
{
|
||||
public static string GenerateString(int length)
|
||||
{
|
||||
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var stringBuilder = new StringBuilder();
|
||||
var random = new Random();
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
stringBuilder.Append(chars[random.Next(chars.Length)]);
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public static string IntToStringWithLeadingZeros(int number, int n)
|
||||
{
|
||||
string result = number.ToString();
|
||||
int length = result.Length;
|
||||
|
||||
for (int i = length; i < n; i++)
|
||||
{
|
||||
result = "0" + result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user