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

Decimal separation sign for numbers

Is there a way to change the system setting for
the decimal separation sign for numbers to "."
from within an application? If there, is could
you *please* give me the complete code?

Many thanks,
best wishes for the New Year
Patrick.

Nov 15 '05 #1
3 2871
Let me reformulate my query. It is the decimal
separator for currency values I am looking
for to change from within an application.
"Patrick De Ridder" <wn********@all.here> wrote in message
news:10***************@evisp-news-01.ops.asmr-01.energis-idc.net...
Is there a way to change the system setting for
the decimal separation sign for numbers to "."
from within an application? If there, is could
you *please* give me the complete code?

Many thanks,
best wishes for the New Year
Patrick.

Nov 15 '05 #2
Hi Patrick,

One quick way to do this is to transfer the number into a culture view
that uses periods instead of commas as does the US.

//since this uses monetary notation in front of the text it might not
be appropriate
int k = 12345;
CultureInfo dk = new CultureInfo("da-DK"); //us --> en-US
string w = k.ToString("c", dk);
Console.WriteLine (w);

you could also use the following code to do what you'd like...

using System;
using System.Globalization;

namespace test1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
int i = int.Parse("123456789");
NumberFormatInfo nfi = new CultureInfo( "en-US", false
).NumberFormat;
nfi.NumberGroupSeparator = "."; //changes from the default of
commas to periods
Console.WriteLine(i.ToString("N", nfi));
}
}
}

~~~~~~~~~~~~~
Tommie Carter
tcarternyc(at)hotmail(dot)com
--
"Patrick De Ridder" <wn********@all.here> wrote in message news:<10***************@evisp-news-01.ops.asmr-01.energis-idc.net>...
Is there a way to change the system setting for
the decimal separation sign for numbers to "."
from within an application? If there, is could
you *please* give me the complete code?

Many thanks,
best wishes for the New Year
Patrick.

Nov 15 '05 #3
Right, I'll have a go with this.

Thank you very much!

Patrick.

"Tom Carter" <tc********@hotmail.com> wrote in message
news:a4**************************@posting.google.c om...
Hi Patrick,

<snipped (qv.)>
Nov 15 '05 #4

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

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
7
by: hana1 | last post by:
Hello experts, I used to program in C/C++ and now switched to Java. I am having a difficulty that I need your help with. How can I limit a double variable to hold 2 decimal points only? Say I...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
18
by: Kuljit | last post by:
I am doing Engineering(B.Tech) in Computer Science. I have a question for which i am struggling to write a C code(program). It struck me when we were being taught about a program which counts the...
3
by: ajaksu | last post by:
Hello c.l.p.ers :) Running long(Decimal) is pretty slow, and the conversion is based on strings. I'm trying to figure out whether there is a good reason for using strings like in decimal.py...
14
by: me2 | last post by:
I am writing a little base conversion utility called base.c. This is what base does. $ base -127 Signed decimal: -127 Unsigned decimal: 4294967169 Hexidecimal: ...
28
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.