Adding Comma Separators
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 5
- Joined: Wed May 04, 2005 8:00 am
Adding Comma Separators
I currently have a job where I have a decimal value, where it needs the comma separators for the thousands. I need a way of putting those in while in a Char format, since I need to right justify the field with spaces.
Example:
Input from database:
49477404.97
Output to file:
49,477,404.97
Remember that I will be formating this to String for Right Justification, so I need the commas to stick.
Thank you.
Example:
Input from database:
49477404.97
Output to file:
49,477,404.97
Remember that I will be formating this to String for Right Justification, so I need the commas to stick.
Thank you.
-
- Participant
- Posts: 5
- Joined: Wed May 04, 2005 8:00 am
Re: Adding Comma Separators
Hi Frank,FrankTheTank wrote: Example:
Input from database:
49477404.97
Output to file:
49,477,404.97
Remember that I will be formating this to String for Right Justification, so I need the commas to stick.
If your string always has two decimal points (ex: 2345.67, 234567.00). Then this solution will work. Do some test on this.
Code: Select all
FMT(Oconv(Ereplace(yourstring,".",''),"MR2,"),"R#":19)
Kris~
-
- Charter Member
- Posts: 130
- Joined: Mon Sep 06, 2004 3:05 am
- Location: Dubai,UAE
Adding Comma Separators
Hi,
Oconv(49477404.97, "MD2,P")
Ans = 49,477,404.97
You can use Oconv(yourinput, "MD2,P")
Hope this helps
Oconv(49477404.97, "MD2,P")
Ans = 49,477,404.97
You can use Oconv(yourinput, "MD2,P")
Hope this helps
Warm Regards,
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
Amruta Bandekar
<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 5
- Joined: Wed May 04, 2005 8:00 am
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 9
- Joined: Tue Apr 05, 2005 4:39 am