digitalmars.D.learn - how to transform decial point "3.15" to "3,15" comma?
- Cassio Butrico (5/5) Sep 15 2014 how to transform decial point "3.15" to "3,15" comma?
- Cassio Butrico (3/4) Sep 15 2014 Hello everyone, I am making a registry of real amounts, and need
- ketmar via Digitalmars-d-learn (13/18) Sep 15 2014 On Mon, 15 Sep 2014 22:47:32 +0000
- AsmMan (10/15) Sep 15 2014 Is the , (comma) the system decimal separator? if so, you can use
- AsmMan (11/28) Sep 15 2014 The code is the following:
- Cassio Butrico (3/31) Sep 15 2014 Okay,
- AsmMan (3/38) Sep 15 2014 you're welcome! :)
how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?
Sep 15 2014
how to transform decial point "3.15" to "3,15" comma?Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print correctly. there is some routine that do this?
Sep 15 2014
On Mon, 15 Sep 2014 22:47:32 +0000 Cassio Butrico via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:why don't do just this: void main () { import std.stdio; import std.string; import std.array; string s =3D "%s".format(3.14).replace(".", ","); writeln(s); } but i believe that separator is locale-dependend, so maybe you should just change locale at program startup?how to transform decial point "3.15" to "3,15" comma?Hello everyone, I am making a registry of real amounts, and need=20 trasformar fractional numbers, so print correctly. there is some=20 routine that do this?
Sep 15 2014
On Monday, 15 September 2014 at 22:45:50 UTC, Cassio Butrico wrote:how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?Is the , (comma) the system decimal separator? if so, you can use C intero and include locale.h header (in D, the respective module) call setlocale(LC_NUMERIC, "") function and then printf("%g", 3.5) will output (if decimal separator is the comma): 3,5 I haven't tested it in D but I think D's writefln() will behave exactly same as C's printf().. but it didn't you're free to call C's printf()
Sep 15 2014
On Monday, 15 September 2014 at 23:17:51 UTC, AsmMan wrote:On Monday, 15 September 2014 at 22:45:50 UTC, Cassio Butrico wrote:The code is the following: import std.stdio; import std.c.locale; void main() { setlocale(LC_NUMERIC, ""); writeln(3.5); // 3,5 } You can change/see current decimal separator using (assuming Windows) http://www.softwareok.com/?seite=faq-Win-7&faq=78how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?Is the , (comma) the system decimal separator? if so, you can use C intero and include locale.h header (in D, the respective module) call setlocale(LC_NUMERIC, "") function and then printf("%g", 3.5) will output (if decimal separator is the comma): 3,5 I haven't tested it in D but I think D's writefln() will behave exactly same as C's printf().. but it didn't you're free to call C's printf()
Sep 15 2014
On Monday, 15 September 2014 at 23:24:13 UTC, AsmMan wrote:On Monday, 15 September 2014 at 23:17:51 UTC, AsmMan wrote:Okay, Thanks everyone, that was itOn Monday, 15 September 2014 at 22:45:50 UTC, Cassio Butrico wrote:The code is the following: import std.stdio; import std.c.locale; void main() { setlocale(LC_NUMERIC, ""); writeln(3.5); // 3,5 }how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?Is the , (comma) the system decimal separator? if so, you can use C intero and include locale.h header (in D, the respective module) call setlocale(LC_NUMERIC, "") function and then printf("%g", 3.5) will output (if decimal separator is the comma): 3,5 I haven't tested it in D but I think D's writefln() will behave exactly same as C's printf().. but it didn't you're free to call C's printf()
Sep 15 2014
On Monday, 15 September 2014 at 23:43:47 UTC, Cassio Butrico wrote:On Monday, 15 September 2014 at 23:24:13 UTC, AsmMan wrote:you're welcome! :)On Monday, 15 September 2014 at 23:17:51 UTC, AsmMan wrote:Okay, Thanks everyone, that was itOn Monday, 15 September 2014 at 22:45:50 UTC, Cassio Butrico wrote:The code is the following: import std.stdio; import std.c.locale; void main() { setlocale(LC_NUMERIC, ""); writeln(3.5); // 3,5 }how to transform decial point "3.15" to "3,15" comma? Hello everyone, I am making a registry of real amounts, and need trasformar fractional numbers, so print coretamente. there is some routine that do this?Is the , (comma) the system decimal separator? if so, you can use C intero and include locale.h header (in D, the respective module) call setlocale(LC_NUMERIC, "") function and then printf("%g", 3.5) will output (if decimal separator is the comma): 3,5 I haven't tested it in D but I think D's writefln() will behave exactly same as C's printf().. but it didn't you're free to call C's printf()
Sep 15 2014