1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

Removed logs, added null or whitespace validation and improved formatting

This commit is contained in:
Andre Rosado
2023-01-03 10:58:14 +00:00
parent 6b77fee72b
commit 7500073e7e
2 changed files with 7 additions and 6 deletions

View File

@@ -77,7 +77,7 @@ namespace Bit.Core.Services
ct.ThrowIfCancellationRequested();
var matchedCiphers = new List<CipherView>();
var lowPriorityMatchedCiphers = new List<CipherView>();
query = (query.Trim().ToLower().RemoveDiacritics());
query = query.Trim().ToLower().RemoveDiacritics();
foreach (var c in ciphers)
{

View File

@@ -6,8 +6,13 @@ namespace Bit.Core.Utilities
{
public static class StringExtensions
{
public static string RemoveDiacritics(this String text)
public static string RemoveDiacritics(this string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return text;
}
var normalizedString = text.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder(capacity: normalizedString.Length);
@@ -20,14 +25,10 @@ namespace Bit.Core.Utilities
stringBuilder.Append(c);
}
}
Console.Write(stringBuilder.Length);
Console.WriteLine(stringBuilder.ToString().Normalize(NormalizationForm.FormC));
return stringBuilder
.ToString()
.Normalize(NormalizationForm.FormC);
}
}
}