diff --git a/src/Humanizer/Bytes/ByteSize.cs b/src/Humanizer/Bytes/ByteSize.cs index 0edb4a5dc..42d465383 100644 --- a/src/Humanizer/Bytes/ByteSize.cs +++ b/src/Humanizer/Bytes/ByteSize.cs @@ -248,7 +248,9 @@ public string ToString(string format, IFormatProvider provider) format = format.Replace("#.##", "0.##"); - bool has(string s) => format.IndexOf(s, StringComparison.CurrentCultureIgnoreCase) != -1; + var culture = provider as CultureInfo ?? CultureInfo.CurrentCulture; + + bool has(string s) => culture.CompareInfo.IndexOf(format, s, CompareOptions.IgnoreCase) != -1; string output(double n) => n.ToString(format, provider); if (has(TerabyteSymbol)) diff --git a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs index ba56b625b..a926b24ec 100644 --- a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs @@ -149,7 +149,7 @@ private static string GetUnitValue(int number, bool isOrdinal) private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth - if (toWords.IndexOf("een", StringComparison.Ordinal) == 0) + if (toWords.StartsWith("een", StringComparison.Ordinal)) { if (toWords.IndexOf("een en", StringComparison.Ordinal) != 0) { diff --git a/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs index a42bb341a..9385e60d6 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArmenianNumberToWordsConverter.cs @@ -167,7 +167,7 @@ private static string GetUnitValue(long number, bool isOrdinal) private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth - if (toWords.IndexOf("մեկ", StringComparison.Ordinal) == 0) + if (toWords.StartsWith("մեկ", StringComparison.Ordinal)) { toWords = toWords.Remove(0, 4); } diff --git a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs index e2b50167c..47f01e99c 100644 --- a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs @@ -154,7 +154,7 @@ private static string GetUnitValue(long number, bool isOrdinal) private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth - if (toWords.IndexOf("one", StringComparison.Ordinal) == 0) + if (toWords.StartsWith("one", StringComparison.Ordinal)) { toWords = toWords.Remove(0, 4); } diff --git a/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs index a79158c91..d8cc1d73d 100644 --- a/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TamilNumberToWordsConverter.cs @@ -269,7 +269,7 @@ private static string GetHundredsValue(ref long number) private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth - if (toWords.IndexOf("one", StringComparison.Ordinal) == 0) + if (toWords.StartsWith("one", StringComparison.Ordinal)) toWords = toWords.Remove(0, 4); return toWords;