Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 7:05 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: 1000 to 1k converter
PostPosted: Wed Sep 30, 2009 10:14 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
I was wondering if someone could write a function that will take a value of like, 1000 and turn it into 1k or 100,000 and turn it into 100k.

Thanks. :D


Top
 Profile  
 
 Post subject: Re: 1000 to 1k converter
PostPosted: Wed Sep 30, 2009 10:29 pm 
Offline
Regular

Joined: Mon Aug 18, 2008 4:31 pm
Posts: 36
Can't you just make it divide the number by 1000 and add a "k" to the end of it?

_________________
Image


Top
 Profile  
 
 Post subject: Re: 1000 to 1k converter
PostPosted: Wed Sep 30, 2009 10:32 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
DarkSpartan4 wrote:
Can't you just make it divide the number by 1000 and add a "k" to the end of it?


I prolly could, but I'd like it to round down so I don't have 1.6828194k


Top
 Profile  
 
 Post subject: Re: 1000 to 1k converter
PostPosted: Wed Sep 30, 2009 10:42 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Already have one :D

Code:
Public Function ConvertCurrency(ByVal Amount As Long) As String
    If Int(Amount) < 10000 Then
        ConvertCurrency = Amount
    ElseIf Int(Amount) < 999999 Then
        ConvertCurrency = Int(Amount / 1000) & "k"
    ElseIf Int(Amount) < 999999999 Then
        ConvertCurrency = Int(Amount / 1000000) & "m"
    Else
        ConvertCurrency = Int(Amount / 1000000000) & "b"
    End If
End Function

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: 1000 to 1k converter
PostPosted: Wed Sep 30, 2009 10:53 pm 
Offline
Persistant Poster

Joined: Fri Jun 26, 2009 10:15 pm
Posts: 701
Google Talk: FAProductions
Awesome. Thanks! :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group