Skip to content

Commit

Permalink
Replace StringBuilder for removing unicode emoji with string.Concat
Browse files Browse the repository at this point in the history
  • Loading branch information
austins committed Feb 14, 2024
1 parent c274055 commit 080e5cc
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions DiscordTranslationBot/Utilities/FormatUtility.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Text;
using System.Text.RegularExpressions;
using Markdig;
using NeoSmart.Unicode;
Expand Down Expand Up @@ -35,13 +34,7 @@ public static string SanitizeText(string text)
result = UrlRegex().Replace(result, string.Empty);

// Remove all unicode emoji.
var stringBuilder = new StringBuilder();
foreach (var letter in result.Letters().Where(letter => !Emoji.IsEmoji(letter)))
{
stringBuilder.Append(letter);
}

result = stringBuilder.ToString();
result = string.Concat(result.Letters().Where(letter => !Emoji.IsEmoji(letter)));

// Trim and return sanitized text.
return result.Trim();
Expand Down

0 comments on commit 080e5cc

Please sign in to comment.