Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
1000 to 1k converter
#1
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. Big Grin
Reply
#2
Can't you just make it divide the number by 1000 and add a "k" to the end of it?
Reply
#3
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
Reply
#4
Already have one Big Grin

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?
Reply
#5
Awesome. Thanks! Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)