-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Bug
Copy link
Description
Based on the current documentation
As there is no IgnoreSymbols equivalent in NSStringCompareOptions all CompareOptions combinations that include IgnoreSymbols throw PlatformNotSupportedException.
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.iOS.cs
Lines 76 to 87 in 2987aba
private static void AssertComparisonSupported(CompareOptions options) | |
{ | |
if ((options | SupportedCompareOptions) != SupportedCompareOptions) | |
throw new PlatformNotSupportedException(GetPNSE(options)); | |
} | |
private const CompareOptions SupportedCompareOptions = CompareOptions.None | CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | | |
CompareOptions.IgnoreWidth | CompareOptions.StringSort | CompareOptions.IgnoreKanaType; | |
private static string GetPNSE(CompareOptions options) => | |
SR.Format(SR.PlatformNotSupported_HybridGlobalizationWithCompareOptions, options); | |
} |
We should remove the exception throw for IndexOf
and other APIs using IgnoreSymbols
compare option and implement a workaround to enable this API. Due to no NSStringCompareOptions that would mimic the same behavior as .NET IgnoreSymbols
we will likely need to:
- Preprocess the strings by removing the symbols (comma, period, colon, etc.).
- Calculate the range on the preprocessed strings.
- Map the range from preprocessed strings back to the input string to get correct index and matchLength.
Add more test cases:
Lines 79 to 80 in 10f0bbf
if (PlatformDetection.IsNotHybridGlobalizationOnApplePlatform) // IgnoreSymbols are not supported | |
yield return new object[] { s_invariantCompare, "More Test's", "Tests", 0, 11, CompareOptions.IgnoreSymbols, 5, 6 }; |