473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CurrentCulture or InvariantCulture?

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)

Apr 16 '07 #1
1 3232
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.
--------------------------------------
"rk" <rk@leapbeyond.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
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)

Apr 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rahul Agarwal | last post by:
Hi I am trying to write data back to the client using dataset.WriteXML and I have set the Thread.CurrentThread.CurrentCulture to "no" (norwegian) just before writing the data using WriteXML....
0
by: Muralidhar Chennoju | last post by:
Hi All How to get the Current DateFormat based on the regional settings. The following statment is giving right data when it is windows based application, but when I try the same in Web...
1
by: DZoid | last post by:
Hi, I have an asp.net page that uses a component in my business tier, which in turn uses a component in my data tier. The business and data tiers are in separate assemblies. I set...
5
by: ra294 | last post by:
When I use the Now() Fucntion i my ASP.net application I get a date format of mm/dd/yy. I want it to be dd/mm/yy. I set in the web config "culture="en-GB" uiCulture="en" and also set the regional...
1
by: cristian | last post by:
Can somebody to give me an example how to use the invariant culture ('CultureInfo.InvariantCulture') Thanks, Cristian
2
by: arne.wiklund | last post by:
Is there an error in the currentCulture.NumberFormat.NumberDecimalSeparator? Take a look at this code: Thread.CurrentThread.CurrentCulture = new CultureInfo("nb-NO");...
5
by: Tsair | last post by:
I set the thread culture in MAIN() as below in order to show the date in format DAY/MONTH/YEAR, but the datagridview alway show the date in M/d/yyyy. How to set the default Date format from...
2
by: LushaM | last post by:
Hi, all! I have a question about CurrentCulture ( System.Globalization.CultureInfo.CurrentCulture ). As I understand, by default, System.Globalization.CultureInfo.CurrentCulture has the same...
4
by: Rainer Queck | last post by:
Hi NG, in my application a <myDataTable>.Select fails with "Syntax error in the expression." It took me a while, isolate the cause to this: To select some datarows from a data table I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.