views:

52

answers:

3

i have some excell data. also excel column i created programmaticaly in sql tablr my excel column on the other hand; some column's name is "mydetail" if converting to to upper MYDETAİL. i must this ToUpper() event : MYDETAIL not MYDETAİL

+5  A: 

I'm guessing that you are Turkish, or at least using a Turkish computer.

In Turkish the "i" does convert to "İ" in upper case.

You need to use a different culture when doing the conversion by using String.ToUpper method that takes an CultureInfo object as an argument. If you use en-US or en-GB you should get what you want.

In fact the example on the page I linked to uses en-US and tr-TR (Turkey-Turkish) on the word "indigo" as an example of the differences.

ChrisF
wowwww how can you realize" i am turkish:"))))
Phsika
@Phsika - Turkish is (as far as I know) the only language that has an upper case I with a dot (İ)
ChrisF
A: 

You will need to call .ToUpper() with the desired CultureInfo. See MSDN with some examples on how to use .ToUpper(CultureInfo).


It is recommended to specify CultureInfo on all String manipulation methods like String.Format(), <primitive>.ToString() or for example Convert.Int32(object, CultureInfo).

FxCop does a good job in reminding you on issues with this in your code.

Filburt
+1  A: 

Try something like:

String result = source.ToUpper(CultureInfo.InvariantCulture);

From MSDN:

use the InvariantCulture to ensure that the behavior will be consistent regardless of the culture settings of the system

Rox
No it is not true
Phsika