From 79029138804447679c8f5aa5e725ae916cfef36d Mon Sep 17 00:00:00 2001 From: XorogVEVO Date: Wed, 23 Feb 2022 23:42:39 +0100 Subject: [PATCH] Added IsoCountryCodeToFlagEmoji --- UniversalExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/UniversalExtensions.cs b/UniversalExtensions.cs index 2c14e5b..3942fda 100644 --- a/UniversalExtensions.cs +++ b/UniversalExtensions.cs @@ -439,6 +439,19 @@ public static class UniversalExtensions /// public static string GetAllDigits(this string str) => new(str.Where(Char.IsDigit).ToArray()); + + + + /// + /// Get country flag emoji based on Iso Country Code + /// + /// + /// + public static string IsoCountryCodeToFlagEmoji(this string country) + { + return string.Concat(country.ToUpper().Select(x => char.ConvertFromUtf32(x + 0x1F1A5))); + } + } public static class StringExt