mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added Locations Create CRUD element, Updated Locations LDAP service methods
This commit is contained in:
19
src/Helpers/StringHelper.cs
Normal file
19
src/Helpers/StringHelper.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Berufsschule_HAM.Helpers;
|
||||
|
||||
public static class StringHelpers
|
||||
{
|
||||
public static string Slugify(string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
input = input.ToLowerInvariant();
|
||||
input = Regex.Replace(input, @"[^a-z0-9\s-]", "", RegexOptions.None, TimeSpan.FromMilliseconds(100));
|
||||
input = Regex.Replace(input, @"[\s-]+", "-", RegexOptions.None, TimeSpan.FromMilliseconds(100));
|
||||
input = input.Trim('-');
|
||||
return input;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user