Hi this is my first extension! hope you enjoy it
Publish date: 2020-10-19T19:20:00Z
Current version: 3
Current version publish date: 2020-11-11T15:00:00Z
Write a short description
This is a simple extension that you can use to format numbers to default formats, or to a custom one
Format
Formats a number to a default format. number ~ int ~ number to be formatted, in meters, bytes or grams format format to:
cm
km
GB
MB
kg
CustomFormat
customize the formatting of a number. number ~ int ~ the number to be formatted prefix and sufix ~ Strings ~ prefix or sufix your number with anything. leave an empty string if you don't want to prefix/sufix multiplyFor ~ int ~ multiply your number for other. if you don't want to use this, put 1. Separate
put a separator into your number. number ~ the number you want to add separator separator ~ the separator you want to use in your number Indirect Methods
These are methods that will raise the indirect formatting event with the value instead of returning it. useful if you want to do something after formatting. Error
error Message ~ int
an error occured
1 = you must choose a valid default format: Direct Method
2 = you must choose a valid default format: Indirect Method IndirectFormatting
Event raised when you use indirect methods
value ~ the return value of the method.
Could somebody provide an example of formatting? like take a 1000000 number and make it into $1,000,000?
Would it be something like: call Number_formatter1.CustomFormat
number = 1000000
prefix = $
sufix = ""
multiplyFor = 1000
?
Or Number_formatter1.Separate
number = 1000000
separator = "."
It should be noted that, in App Inventor, as soon as you start "formatting" a number, it becomes a string. To use it as a number after "formatting" one has to convert it back to a number - remove all formatting.
Ok. It is returning strings so error.
Use join $ and separate with , the number you want.
P.S. if you want currencies you should specify wich dollar type you want (U.S., Canada, etc. Use $)