CurrentCulture or InvariantCulture?

R

rk

Hi there,

I'm creating a console program that will process command line
switches. When checking whether a switch exists on the command line
(for example "/input"), should I use CurrentCulture, InvariantCulture,
or something else?

I want it to match under all of the following circumstances:

1) User types in the keys i-n-p-u-t using any casing, and under any
culture/language.
In Turkish, for example, an uppercase i is actually an I with a dot on
top. I'm assuming the special I-dot character is what the console
reads from the keyboard when they hold shift and press i.

2) Invoked from a batch file created using a different language/
culture.
Here's where it gets tricky. Let's say a user in North America writes
a batch file and shares it with his Turkish friend. Now I want the
string to match BOTH the Turkish INPUT (dotted i) and the North
American INPUT (non-dotted i).

Is there an easy way to get the comparison result I want?

Thanks,

Richard Kagerer
(Missing the days when the = sign was straightforward)
 
R

RobinS

It depends if the only difference is the letters. What if someone in
WeirdCountryistan used *their* word for input which was %*R$#( ? Are you
going to parse for that, too? Or do you only care about Turkey?

I would store the comparison strings in the resource file for each language
you are interested in supporting. Then retrieve the resource and compare
against the command line data.

It will look for a resource matching the current culture, and if not found,
go up the tree until it hits the invariant culture.

Hope this helps.

Robin S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top