sawang Newbie
Joined: 06 Mar 2005 Posts: 8
|
Posted: Tue Oct 18, 2005 6:18 pm Post subject: Numbers to their proper display |
|
|
Is there any dll or code or dsu to display numbers to their proper view [ 12345678 ---> 12,345,678 ( the comma I mean) ] ? I had to hardcoded this :
| Code: |
EXTERNAL @path(%0)string.dll
%%vdsver = @sysinfo(dsver)
if @equal(@substr(%%vdsver,1),5)
#define function,string
end
%a = 188081545464321564843534867654321654867364321324.00
%%sep = ","
option fieldsep,.
parse "%%parsed;%%cent",%a
list create,1
%c = 1
repeat
list add,1,@substr(%%parsed,%c,%c)
%c = @succ(%c)
until @equal(%c,@succ(@len(%%parsed)))
list reverse,1
%b = @pred(@count(1))
repeat
list seek,1,%b
%d = @item(1)%d
%b = @pred(%b)
until @equal(%b,-1)
%k = %d
repeat
if @greater(@len(%d),3)
%e = @strins(%d,4,%%sep)
%f = %f@substr(%e,1,4)
%d = @strdel(%d,1,3)
until @not(@greater(@len(%d),3))
end
%h = @fsub(@len(%f),@string(StringCount, %f, %%sep))
%l = @substr(%k,@succ(%h),@len(%k))
list create,2
%1 = 1
repeat
list add,2,@substr(%f%l,%1,%1)
%1 = @succ(%1)
until @equal(%1,@succ(@len(%f%l)))
list reverse,2
%1 = 0
repeat
list seek,2,%1
%%output = %%output@item(2)
%1 = @succ(%1)
until @equal(%1,@count(2))
list close,1
list close,2
info %a@cr()@cr()%%output.%%cent
|
And i want to know how to make this a custom function and call it in vds5; that is if anybody willing to teach me. I'm a newB, so pls help me on this. |
|