wpf - VB.net: How to format money/numbers? -
i not know how come code format numbers.
example: input textbox : 1000 result in textbox2: 1k example: input textbox : 1000000 result in textbox2: 1m example: input textbox : 1000000000 result in textbox2: 1b example: input textbox : 2147483647 result in textbox2: 2.147483647b example: input textbox : 583967 result in textbox2: 583.967k
how do that? please help!!
this can achieved conditional arithmetic grouping
imports system public module module1 public sub main() dim input ulong console.write("enter number: ") input = convert.touint64(console.readline()) console.writeline(formatnumber(input)) end sub public function formatnumber(byval input ulong) string dim result string = input.tostring() if input >= 1000000000 result = string.format("{0}b", input / 1000000000) else if input >= 1000000 result = string.format("{0}m", input / 1000000) else if input > 1000 result = string.format("{0}k", input / 1000) end if return result end function end module
results:
enter number: 123000000000 123b
Comments
Post a Comment