Avatar billede omn Mester
24. marts 2022 - 17:34 Der er 5 kommentarer og
1 løsning

Convert decimal character in number

How can I convert a number DKK  80.567,00 (Danish) to  DKK 80,567.00  (American).
The number must be uploaded to a 3 part system which expect numbers in American format.
Thanks in advance
OMN
Avatar billede Jørgen Kirkegaard Professor
24. marts 2022 - 17:44 #1
Cut the "." and replace "," with "." :-)
Avatar billede jakobdo Ekspert
24. marts 2022 - 18:57 #2
And if you really want it to be converted from:

Danish: 80.567,00
American: 80,567.00

You can start replace . with #
Then replace , with .
And last: # with ,

Then you should have the format you want.
Avatar billede Gustav Ekspert
24. marts 2022 - 21:49 #3
If you can skip the thousand separator, you do a direct conversion:

? Str(CCur("80.567,80"))
80567.8
Avatar billede omn Mester
27. marts 2022 - 18:14 #4
I can skip the thousand separator, but I can't skip the decimals. In all the suggested solutions to my question I loose the decimals in cases ",00" -> "" and ",80" -> ",8" and that's not so good.
Avatar billede jakobdo Ekspert
27. marts 2022 - 19:13 #5
Why is it a problem that ,80 turns into ,8?

The value is the same in the end
Avatar billede omn Mester
27. marts 2022 - 21:47 #6
Hi  jakobdo

I agree  that it is the same.
We are in a situation that data must be manually typed into another system and then the visual layout is important to speed up the proces and minimize mistakes.
I accept your solution and add "0" in cases where lost and accept character format.
OMN
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester