forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Numbers to their proper display

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
sawang
Newbie


Joined: 06 Mar 2005
Posts: 8

PostPosted: Tue Oct 18, 2005 6:18 pm    Post subject: Numbers to their proper display Reply with quote

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.
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Oct 19, 2005 1:08 am    Post subject: Reply with quote

the excellent string.dll will do that for you in one line of code Smile

you can download it from vdsworld.com

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group