Skip to content

[iOS][globalization] Implementing locale-sensitive IsPrefix with correct matchLength output parameter on iOS #111894

Open
@matouskozak

Description

@matouskozak

Based on the current documentation

Apple Native API does not expose locale-sensitive endsWith/startsWith function. As a workaround, both strings get normalized and weightless characters are removed. Resulting strings are cut to the same length and comparison is performed. As we are normalizing strings to be able to cut them, we cannot calculate the match length on the original strings. Methods that calculate this information throw PlatformNotSupported exception.

// Linguistic comparison requested and we don't need to special-case any args.
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_HybridGlobalizationWithMatchLength);
}
#endif

We should remove the exception throw for IsPrefixx/IsSuffix APIs and instead document the differences in returned matchLength or improve the implementation to give correct results.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions