Mirage Source http://www.miragesource.net/forums/ |
|
1000 to 1k converter http://www.miragesource.net/forums/viewtopic.php?f=143&t=6256 |
Page 1 of 1 |
Author: | Matt [ Wed Sep 30, 2009 10:14 pm ] |
Post subject: | 1000 to 1k converter |
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. |
Author: | DarkSpartan4 [ Wed Sep 30, 2009 10:29 pm ] |
Post subject: | Re: 1000 to 1k converter |
Can't you just make it divide the number by 1000 and add a "k" to the end of it? |
Author: | Matt [ Wed Sep 30, 2009 10:32 pm ] |
Post subject: | Re: 1000 to 1k converter |
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 |
Author: | Robin [ Wed Sep 30, 2009 10:42 pm ] |
Post subject: | Re: 1000 to 1k converter |
Already have one 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 |
Author: | Matt [ Wed Sep 30, 2009 10:53 pm ] |
Post subject: | Re: 1000 to 1k converter |
Awesome. Thanks! |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |