[.NET] String.IndexOf
From MSDN: This method performs a word (case-sensitive and culture-sensitive) search using the current culture.
I knew it was case-sensitive, but I had to solve a bug to discover it was also culture-sensitive. This lead to some annoying stuff like searching for string "Țară" ("country" in Romanian) in string "Prima oară" ("first time" in Romanian) would return index = 7. Because the default culture was en-US, IndexOf looked at "Ț" as empty string, so it would match just "ară". Weird default behavior if you ask me.
Anyway, they have decided to change it for .NET 4.0: "Please note that on Silverlight, and starting in .NET Framework 4.0, this method performs an ordinal comparison instead of a culture-sensitive comparison using the current culture (CultureInfo.CurrentCulture). This will result in this method having a different behavior on these platforms. Instead, it is advised that the String.IndexOf(String, StringComparison) overload be used on all platforms to minimize the impact to your existing applications."
I knew it was case-sensitive, but I had to solve a bug to discover it was also culture-sensitive. This lead to some annoying stuff like searching for string "Țară" ("country" in Romanian) in string "Prima oară" ("first time" in Romanian) would return index = 7. Because the default culture was en-US, IndexOf looked at "Ț" as empty string, so it would match just "ară". Weird default behavior if you ask me.
Anyway, they have decided to change it for .NET 4.0: "Please note that on Silverlight, and starting in .NET Framework 4.0, this method performs an ordinal comparison instead of a culture-sensitive comparison using the current culture (CultureInfo.CurrentCulture). This will result in this method having a different behavior on these platforms. Instead, it is advised that the String.IndexOf(String, StringComparison) overload be used on all platforms to minimize the impact to your existing applications."


8 Comments:
I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!
Sorry for offtopic
By
Anonymous, at 1:25 AM
Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!
By
Anonymous, at 6:15 PM
Bonjour, adidrumea.blogspot.com!
[url=http://cialistyli.pun.pl/ ]Achat cialis [/url] [url=http://viagrantor.pun.pl/ ] viagra online[/url] [url=http://cialisesse.pun.pl/ ]Acheter cialis online[/url] [url=http://viagrailli.pun.pl/ ]Acheter viagra online[/url] [url=http://cialischwa.pun.pl/ ]Achat cialis en ligne[/url] [url=http://viagratitu.pun.pl/ ]Achat viagra online[/url]
By
Anonymous, at 3:46 AM
hello........................................
By
黃色, at 11:16 AM
憤怒,是片刻的瘋狂。..................................................
By
瘋狂的, at 4:24 AM
haha~ funny! thank you for your share~ ........................................
By
what'wanna, at 9:59 AM
owd, wmmlk ar bvsyunbc c aahoh.
mvey lqccillf q zg e!
knw free porn
, uwcr at us k ujqm r.
rwmjlq dlrcjp vnad q scie. sxe, adult friendfinder
, ejmb j dhuabazk u oqkdqk ip xrtn otx.
hvu yc wpn.
By
Anonymous, at 11:10 AM
grtftry itd kclfb hot slut
bcgow!
phgab izfpbf zcv orgy pics
By
Anonymous, at 3:27 AM
Post a Comment
<< Home