Skip to content
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

Unexpected result for string.IndexOf((char)0, StringComparison.InvariantCultureIgnoreCase) #94556

Closed
KlestovAlexej opened this issue Nov 8, 2023 · 4 comments

Comments

@KlestovAlexej
Copy link

C# .NET 7

// 0
Console.WriteLine("qwerty".IndexOf((char)0, StringComparison.InvariantCultureIgnoreCase));

// -1
Console.WriteLine("qwerty".IndexOf((char)0));

// -1
Console.WriteLine("qwerty".IndexOf('z'));

// -1
Console.WriteLine("qwerty".IndexOf('z', StringComparison.InvariantCultureIgnoreCase));

@mairaw mairaw transferred this issue from dotnet/core Nov 9, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 9, 2023
@ghost
Copy link

ghost commented Nov 9, 2023

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

Issue Details

C# .NET 7

// 0
Console.WriteLine("qwerty".IndexOf((char)0, StringComparison.InvariantCultureIgnoreCase));

// -1
Console.WriteLine("qwerty".IndexOf((char)0));

// -1
Console.WriteLine("qwerty".IndexOf('z'));

// -1
Console.WriteLine("qwerty".IndexOf('z', StringComparison.InvariantCultureIgnoreCase));

Author: KlestovAlexej
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@huoyaoyuan
Copy link
Member

See #46569, #47145, #54951 and so on.

@huoyaoyuan
Copy link
Member

Should we link to some description of this behavior in the documentation of string.IndexOf? Currently I'm not seeing any.

@tarekgh
Copy link
Member

tarekgh commented Nov 9, 2023

@huoyaoyuan we have doc at https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#stringindexof for this behavior but I think it will be a good idea add something to IndexOf. Are you interested in submitting PR for it?

@tarekgh tarekgh closed this as completed Nov 9, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 9, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants