Subject: updated utility options

From: Solar Power Coupon <[email-masked]>
Date: Thu, 29 May 2014 09:51:27 -0700

ATTN: Ipp-archive

Redeem Your Solar Coupon Below

Cant View the Image Below? Click Here

© 2009-2013 Solar America | Solar-America.org

This is an advertisement. If you no longer wish to receive mail from Solar-America.org send mail to:
1601 N Sepulveda Blvd Ste 227, Manhattan Beach, CA 90266,
or you may click here to unsubscribe

t and you are probably right. This question is ancient and I need to read over it again, but I think I'll change the accepted answe

Why not culture.CompareInfo.IndexOf(paragraph, word, CompareOptions.IgnoreCase) >= 0? That uses the right culture and is case-insensitive, it doesn't allocate temporary lowercase strings, and it avoids the question of whether converting to lowercase and comparing is always the same as a case-insensitive comparison. Quartermeister Mar 18 '13 at 15:3

@Quartermeister that'll work. I tried to find out how CompareInfo.IndexOf defines case-insensitive comparison, but the method simply wraps InternalFindNLSStringEx which is undocumented. Colonel Panic Mar 18 '13 at 15:41

This solution also needlessly pollutes the heap by allocating memory for what should be a searching function JaredPar Mar 18 '13 at 16:09

Comparing with ToLower() will give different results from a case-insensitive IndexOf when two different letters have the same lowercase letter. For example, calling ToLower() on either U+0398 "Greek Capital Letter Theta" or U+03F4 "Greek Capital Letter Theta Symbol" results in U+03B8, "Greek Small Letter Theta", but the capital letters are considered different. Both solutions consider lowercase letters with the same capital letter different, such as U+0073 "Latin Small Letter S" and U+017F There is MSDN documentation for FindNLSStringEx, and that probably applies to InternalFindNLSStringEx. The flag is NORM_IGNORECASE, which "ignores any tertiary distinction, whether or not it is actually linguistic case", but I don't know enough about NLS to know what a "tertiary distinction" is. Quartermeister Mar 18 'To make this answer a little more complete, considering you want to do web mining: If you don't know the language of a pa
ge a-priori, you can quite easily figure out with a simple unigram-based language model. The only problem is getting the data for enough different languages - but probably there are libraries out there that can predict a page's language - i would guess this is a common enough problem. kutschkem Mar@Quartermeister - tertiary distinction is case distinction. Could be linguistic (turkish i -> ) or not (ascii i -> I). A definition can be found on oracle site:

@Quartermeister - and BTW, I believe .NET 2 and .NET4 behave differently on this as .NET 4 always uses NORM_LINGUISTIC_CASING while .NET 2 did not (this flags has appeared with Windows Vista). Simon Mourier Mar 23 '13 at 8:13

Yes, you are very right about Turkish. => I, i => Hooijdonk Apr 9 '13 at 13:58

Should you move method with CompareOptions.IgnoreCase to be first, because .would recommend, in the same spirit, adding CompareOptions.IgnoreKanaType and CompareOptions.IgnoreWidth. emodendroket Apr 29 at 14:56

+1 for completeness - answers with a proper form of explanation are the only way users will actually learn from SO SemiDemented May 5 at 12:57