Skip to content

IndexOf doesn't return a valid result #22318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PJanovsky opened this issue Mar 6, 2025 · 1 comment
Closed

IndexOf doesn't return a valid result #22318

PJanovsky opened this issue Mar 6, 2025 · 1 comment

Comments

@PJanovsky
Copy link

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

.NET 9.0.100

Description

In the project targetting the framework net9.0-ios, IndexOf method doesn't work properly on strings in other cultures than "en" when the string is not found.

Note: It works properly in the Console application build for net9.0

Steps to Reproduce

This code returns "4" but "-1" is expected:
return "test".IndexOf("x", "test".Length)

Sample sln is attached.

iOSApp1.zip

Did you find any workaround?

StringComparison.Ordinal must be explicitly used for IndeOf method.

Relevant log output

No response

@rolfbjarne
Copy link
Member

This looks very much like dotnet/runtime#111340, so closing as a duplicate of that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants