This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:.net core 3.1]
Using .NET 5 IndexOf(string) returns wrong index.
This is reproducible only for some input strings, when the culture is set to Thai.
Example:
CultureInfo.CurrentCulture = new CultureInfo("th");
var idxSeparator = "27".IndexOf("."); // returns 0 instead of -1
idxSeparator = "0".IndexOf("."); // returns -1 as expected
idxSeparator = "3".IndexOf("."); // returns -1 as expected
idxSeparator = "3345".IndexOf("."); // returns 0 instead of -1
Notes
- in .netcore3.1 it returned -1 for all examples above (as I would expect)
- In other languages this is not reproducible also in .Net 5
- Indexof(char) does not have this problem
Original Comments
Feedback Bot on 9/7/2021, 01:21 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:.net core 3.1]
Using .NET 5 IndexOf(string) returns wrong index.
This is reproducible only for some input strings, when the culture is set to Thai.
Example:
CultureInfo.CurrentCulture = new CultureInfo("th");
var idxSeparator = "27".IndexOf("."); // returns 0 instead of -1
idxSeparator = "0".IndexOf("."); // returns -1 as expected
idxSeparator = "3".IndexOf("."); // returns -1 as expected
idxSeparator = "3345".IndexOf("."); // returns 0 instead of -1
Notes
Original Comments
Feedback Bot on 9/7/2021, 01:21 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)