Original Author Paul Laughton, 2011
Page 70
De Re BASIC!
USING$({<locale_sexp>} , <format_sexp> { , <exp>}...)
Returns a string, using the locale and format expressions to format the expression list.
This function gives BASIC! programs access to the Formatter class of the Android platform. You can find
full documentation here:
The <locale_sexp> is a string that tells the formatter to use the formatting conventions of a specific
language and region or country. For example, "en_US" specifies American English conventions.
The <format_sexp> is a string that contains format specifiers, like "%d" or "%7.2f," that tell the
formatter what to do with the expressions that follow.
The format string is followed by a list of zero or more expressions. Most format specifiers take one
argument from the list, in order. If you don't provide as many arguments as your format string needs,
you will get a detailed Java error message.
Each expression must also match the type of the corresponding format specifier. If you try to apply a
string format specifier, like "%-7s", to a number, or a floating point specifier, like "%5.2f" to a string, you
will get a Java error message.
Locale expression
The USING$() function can localize the output string based on language and region. The locale specifies
the language and region with standardized codes. The <locale_sexp> is a string containing zero or more
codes separated by underscores.
The function accepts up to three codes. The first must be a language code, such as "en", "de", or "ja".
The second must be a region or country code, such as "FR", "US", or "IN". Some language and country
combinations can accept a third code, called the "variant code".
The function also accepts the standard three-letter codes and numeric codes for country or region. For
example, "fr_FR", "fr_FRA", and "fr_250" are all equivalent.
If you want to use the default locale of your Android device, make the <locale_exp> an empty string (""),
or leave it out altogether. If you leave it out, you must keep the comma: USING$(, "%f", x)
If you make a mistake in the <locale_sexp>, you may get an obscure Java error message, but more likely
your locale will be ignored, and your string will be formatted using the default locale of your device.
Android devices do not support all possible locales. If you specify a valid locale that your device does not
understand, your string will be formatted using the default locale.
Format expression
If you are familiar with the printf functions of C/C++, Perl, or other languages, you will recognize most of
format specifiers of this function. The format expression is exactly the same as format string of the Java