‎2007 Jan 18 7:09 AM
Hi,
i am checking the currency format amount.the rule is Right justify amount decimal point and 2 decimal places. Not to use commas or the $ sign.
for the above condition the code is:
data:val type string.
val = '123456789.00'.
if val co '.0123456789'.
shift val right deleting TRAILING space.
else.
if val cs ',' or val = '$'.
replace ',' with space into val.
replace '$' with space into val.
endif.
endif.
but iam getting '$' and ','. mark in o/p.
how can we check this condition.help me out from this issue.
Thanks
Message was edited by:
skk
‎2007 Jan 18 7:37 AM
Try this.
[code]parameters : val(30) type c.
data : final(30) type c,
cnt type i,
v type c,
n type i.
cnt = strlen( val ).
do cnt times.
move val+n(1) to v.
if v ca '.0123456789'. "Bring in the values
move v to final+n(1).
*elseif v = ',' or v = '$'. "<---no need of this
*continue. "<----no need
endif.
n = n + 1.
enddo.
condense final no-gaps.
write:/ final .[/code]
regards,
vijay
‎2007 Jan 18 11:06 AM
I believe the answer given by vijay is quite enough to solve the issue. There are other methods also for doing same using the String functionality in sync with the data type 'N' in which no commas or sign will be used. You can use your existing code by just moving the value to N type of field at the end.
Hope this solves your issue.
Raj