C
Claire
I'm monitoring key presses in an edit box on a pocket pc device.
It's for floating point numbers and Im allowing '-', '0'..'9', #8 plus
decimal point character.
Ive a function that should return a char representing the decimal point for
this locale.
Not knowing what I was doing on .net, I did a google and came up with some
code that I changed as follows.
It looks really ugly and I wondered if I needed to do all this to read back
a decimal separator value. Please would someone change my code. I don't know
if it works, it returns a '.' OK for my english pocketpc, but I wouldn't
know how to set up
pocketpc to change locale for test purposes.
public static char DecimalSeparator()
{
char c;
System.Globalization.CultureInfo ci =
System.Globalization.CultureInfo.CurrentUICulture;
System.Globalization.NumberFormatInfo ni =
(System.Globalization.NumberFormatInfo)
ci.NumberFormat.Clone();
c = (ni.NumberDecimalSeparator.ToCharArray())[0];
return c;
}
It's for floating point numbers and Im allowing '-', '0'..'9', #8 plus
decimal point character.
Ive a function that should return a char representing the decimal point for
this locale.
Not knowing what I was doing on .net, I did a google and came up with some
code that I changed as follows.
It looks really ugly and I wondered if I needed to do all this to read back
a decimal separator value. Please would someone change my code. I don't know
if it works, it returns a '.' OK for my english pocketpc, but I wouldn't
know how to set up
pocketpc to change locale for test purposes.
public static char DecimalSeparator()
{
char c;
System.Globalization.CultureInfo ci =
System.Globalization.CultureInfo.CurrentUICulture;
System.Globalization.NumberFormatInfo ni =
(System.Globalization.NumberFormatInfo)
ci.NumberFormat.Clone();
c = (ni.NumberDecimalSeparator.ToCharArray())[0];
return c;
}