Does this already exist?
Something like "\£" that would appear like a "," or "." dependent on the
current locale settings.
Examples:
string stringValue = "1000\£54"
Console.WriteLi ne(stringValue) ;
// Outputs "1000,54" or "1000.54" dependent on locale settings:
double doubleValue = Convert.ToDoubl e(stringValue);
// Will always convert correctly and not ignore
// seperator if it doesn't match locale settings
float floatValue = 34.65F
string stringFromFloat = floatValue.ToSt ring();
// stringFromFloat will now contain "34\£65"
Console.WriteLi ne(stringFromFl oat);
// ...but still output "34,65" or "34.65"
....
Anyway, how can I determine which is the current decimal seperator? In a
text field I want to automatically correct the typed seperator if the user
has typed the wrong one according to the locale (I assume that the user
doesn't want to type digit grouping symbols).
Thank you very much, any answer is appreciated
regards, Teis 2 1649
On Fri, 19 Nov 2004 18:03:57 +0100, "Teis Draiby"
<te************ *@draiby.com> wrote: Does this already exist?
Something like "\£" that would appear like a "," or "." dependent on the current locale settings.
Examples: string stringValue = "1000\£54" Console.WriteLi ne(stringValue) ; // Outputs "1000,54" or "1000.54" dependent on locale settings:
double doubleValue = Convert.ToDoubl e(stringValue); // Will always convert correctly and not ignore // seperator if it doesn't match locale settings
float floatValue = 34.65F string stringFromFloat = floatValue.ToSt ring(); // stringFromFloat will now contain "34\£65" Console.WriteLi ne(stringFromFl oat); // ...but still output "34,65" or "34.65" ... Anyway, how can I determine which is the current decimal seperator? In a text field I want to automatically correct the typed seperator if the user has typed the wrong one according to the locale (I assume that the user doesn't want to type digit grouping symbols).
Thank you very much, any answer is appreciated
regards, Teis
You can find out like so:
Dim strDecimal As String =
CultureInfo.Cur rentCulture.Num berFormat.Numbe rDecimalSeparat or
HTH,
ru
Thank you! That was exactly what I was looking for.
In .NET everything is right at your hand. I knew it!
Regards, teis.
"ru" <ur@sx3.be> wrote in message
news:aj******** *************** *********@4ax.c om... On Fri, 19 Nov 2004 18:03:57 +0100, "Teis Draiby" <te************ *@draiby.com> wrote:
Anyway, how can I determine which is the current decimal seperator? In a text field I want to automatically correct the typed seperator if the
userhas typed the wrong one according to the locale (I assume that the user doesn't want to type digit grouping symbols).
Thank you very much, any answer is appreciated
regards, Teis
You can find out like so: Dim strDecimal As String = CultureInfo.Cur rentCulture.Num berFormat.Numbe rDecimalSeparat or
HTH, ru This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ksenia Marasanova |
last post by:
Hi,
I have some problems with locale module.
On my workstation, changing locale doesn't have effect:
Python 2.3 (#1, Sep 13 2003, 00:49:11)
on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'nl_NL')
|
by: Jorgen Grahn |
last post by:
I'm sitting here with a Debian Linux 'Woody' system with the default Python
2.2 installation, and I want the re module to understand that
re.compile(r'\W+'. re.LOCALE) doesn't match my national, accented
characters.
I don't quite understand how the locale module reasons about these things,
and Python doesn't seem to act as other programs on my system. Bug or my
mistake? Here's my environment:
frailea> env |grep -e LC -e LANG
|
by: Cagdas Ozgenc |
last post by:
Greetings.
I am confused about C++ standard library locale stuff. It seems as if the
implementations of locales are not part of the library, but only some
guideline classes are there.
What is the standard conformant way of formatting and parsing locale
specific date, time, strings with various character encoding, etc.
Thanks
|
by: |
last post by:
Hi all,
running the following code as an console application:
#include <locale>
#include <iostream>
#include <sstream>
#include <tchar.h>
using namespace std;
|
by: robert |
last post by:
Why can the default locale not be set by its true name? but only by '' ? :
PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win32.
(None, None)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python25\lib\locale.py", line 476, in setlocale
return _setlocale(category, locale)
Error: unsupported locale setting
| |
by: cris |
last post by:
Hi,
I got trouble when I try to change the locale used in a program foo.cc
// ----------------- begin
#include <iostream>
#include <locale>
#include <exception>
using namespace std;
int main(int argc, char** argv)
|
by: Daniele C. |
last post by:
I will report a snippet from http://php.net/setlocale
I spent about 2 seconds before thinking: can it really be? I mean, is
there no way to set locale info per thread? And after a brief web
search I came up with this keyword: _configthreadlocale
Read more at http://msdn2.microsoft.com/en-us/library//26c0tb7x(VS.80).aspx
(beware, this page is very slow or their servers are anyway).
Looks like this function exists since Windows 95 and...
|
by: Donn Ingle |
last post by:
Hello,
I hope someone can illuminate this situation for me.
Here's the nutshell:
1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale.
2. If this returns "C" or anything without 'utf8' in it, then things start
to go downhill:
2a. The app assumes unicode objects internally. i.e. Whenever there is
|
by: Gabriel Genellina |
last post by:
En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins
<robert.rawlins@thinkbluemedia.co.ukescribi�:
Probably you don't have support for 'de_DE' locale.
Try using locale.setlocale(locale.LC_ALL, '')
and see what you get in response.
I'd like to know how to retrieve that too...
|
by: Mario Ruggier |
last post by:
Hi,
i had the following problem when installing py3.0rc1 on a Mac OS X
10.5.5. On this system, the default locale values are:
$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |