473,416 Members | 1,730 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,416 software developers and data experts.

Handling different decimal separators

Some countries use comma instead of point as the decimal separator (and
presumably there are other variations)

If one has a set of ascii files containing numbers stored in one culture
is there some standard method for reading them in another culture?

Thanks

Jack Russell
Nov 23 '05 #1
2 2075
"Jack Russell" <ja***@norubbish.tpg.com.au> schrieb:
Some countries use comma instead of point as the decimal separator (and
presumably there are other variations)

If one has a set of ascii files containing numbers stored in one culture
is there some standard method for reading them in another culture?


Yes, if you know which culture has been used to write the data to the file:

\\\
Imports System.Globalization
..
..
..
Dim nf As NumberFormatInfo = _
CultureInfo.CreateSpecificCulture("de-DE").NumberFormat
Dim i As Integer = Integer.Parse("2323,123", nf)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 23 '05 #2
Thank you
Herfried K. Wagner [MVP] wrote:
"Jack Russell" <ja***@norubbish.tpg.com.au> schrieb:
Some countries use comma instead of point as the decimal separator
(and presumably there are other variations)

If one has a set of ascii files containing numbers stored in one
culture is there some standard method for reading them in another
culture?

Yes, if you know which culture has been used to write the data to the file:

\\\
Imports System.Globalization
..
..
..
Dim nf As NumberFormatInfo = _
CultureInfo.CreateSpecificCulture("de-DE").NumberFormat
Dim i As Integer = Integer.Parse("2323,123", nf)
///

Nov 23 '05 #3

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

Similar topics

5
by: Ordz | last post by:
I want to write a program that will take a decimal with up to 4 places and convert it to 1/16 ths. I can sort of do that with: n = 375 * 16 / 1000 Print n; "/16" I am planning to use an input...
3
by: GP | last post by:
Decimal.Parse("100,5") returns 1005 when it should throw an InvalidFormatException. The locale is US therefore the "," is a thousand separator. Even if the parser confused it for the decimal...
10
by: T.K Kullervo | last post by:
Hi, is there someway to change the regional settings--> numbers--> decimal separator for the the program im creating. I dont want to change it permanently but my program doesnt work if the...
0
by: steve | last post by:
Hi, I am testing my application on a different computer with French Language Settings and Win 2000. I have English and XP Professional. We both have the same version of .NET. Apart from the...
7
by: Oenone | last post by:
Can anyone explain why the following happens? \\\ Dim d1 As Decimal = CDec("100") Dim d2 As Decimal = CDec("100.00") MsgBox(d1.ToString) 'displays "100" MsgBox(d2.ToString) 'displays...
8
by: Rico | last post by:
Hello Everyone, I observed something strange in some quick testing code: void Button1Click(object sender, System.EventArgs e) { CultureInfo culture = new CultureInfo("th-TH", false); ...
2
by: apattin | last post by:
Hi all, I have a table containing MEASURE DOUBLE. I want to SELECT measure FROM mytable WHERE <condition> If measure = 1860.45, I get: '1,860.45'. How can I strip the comma? I tried: ...
7
by: JohnC | last post by:
Hello people, I thought I was fairly proficient in websearching, but I haven't found a standard on how to encode numerical values in an XML file in a standard way. XML docs do specify character...
3
by: =?Utf-8?B?THVpZ2k=?= | last post by:
Hi all, with this code: decimal? test = 1200345.56m; decimal? test2 = Decimal.Parse(String.Format("{0:0,0.000}", test)); i can not obtain a decimal value with thousands separators (but...
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
marktang
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,...
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
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...
0
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...
0
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...

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.