init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
30
Kreta.BusinessLogic/Extensions/NameExtensions.cs
Normal file
30
Kreta.BusinessLogic/Extensions/NameExtensions.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Kreta.Core;
|
||||
|
||||
namespace Kreta.BusinessLogic.Extensions
|
||||
{
|
||||
public static class NameExtensions
|
||||
{
|
||||
public static string CleanElotag(this string elotag)
|
||||
{
|
||||
var trimmed = elotag.ReplaceMultipleSpacesAndTrim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(trimmed))
|
||||
{
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
return GetStringWithoutDuplicatedDots(trimmed);
|
||||
}
|
||||
|
||||
public static string GetNevSorrendben(string nevSorrend, string nevElotag, string vezetekNev, string keresztNev)
|
||||
=> $"{nevElotag} {(string.Equals(nevSorrend, "F", StringComparison.OrdinalIgnoreCase) ? $"{vezetekNev} {keresztNev}" : $"{keresztNev} {vezetekNev}")}".ReplaceMultipleSpacesAndTrim();
|
||||
|
||||
private static string GetStringWithoutDuplicatedDots(string text)
|
||||
=> NullableRegexReplace(text, @"\.+", ".");
|
||||
|
||||
private static string NullableRegexReplace(this string text, string pattern, string replacement)
|
||||
=> string.IsNullOrWhiteSpace(text) ? text : Regex.Replace(text, pattern, replacement);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue