FStr$

Purpose:

Formats a number according to the format string.

These consist of the following characters ("if negative" refers to the value to be formatted):

*

Digit or '*'-Prefix

$

Local currency symbol

-

Digit or sign, if negative

+

Digit or sign

(

Digit or '('-Prefix if negative

)

')'-Postfix if negative

#

Digit or space prefix

&

Digit or '0'

?

Any number of characters

.

Decimal point

,

Comma, or space prefix

A prefix is a sign that precedes a value, when needed. The expression Fstr$(1, "***") results in "**1". The value "1" is preceded by the characters "**".

A Postfix is a character that, when needed, is placed after a number.

These formatting characters can be combined as needed. If the number is too large for the desired format, a "*” string will be returned.

With the third (optional) parameter, additional formatting can be accomplished.

1

Removal of leading spaces.

The use is similar to the functions RTrim$() and LTrim$().

2

Empty string if value Null.

3

Removal of leading spaces and empty strings when value is 0

Parameter:

Number

String          Format string

Number       (optional) Additional formatting

Return value:

String

Example:

Fstr$(3.142, "#")                          Result: "3"

Fstr$(0,"#",2)                     Result: ""

Fstr$(0003.142,"#.###",1)           Result: "3,142"

Fstr$(3.1,"######&.###",4)       Result: "3,1"

Fstr$(3.1,"######&.###") Result: "3,100"

Fstr$(.1,"######&.###")           Result: "0,100"

Fstr$(5003.1,"#,###.&&")             Result: "5.003,10"

Fstr$(3.142,"#.###")           Result: "3,142"

Fstr$(3.142,".######")               Result: "*******"

Fstr$(3.142,"(#.###)")                 Result: " 3,142 "

Fstr$(-3.142,"(#.###)")                Result: "(3,142)"

Fstr$(3.142,"+#.###")                 Result: "+3,142"

Fstr$(3.142,"-#.###")                  Result: " 3,142"

Fstr$(-3.142,"-#.###")                 Result: "-3,142"

Fstr$(3.142,"&&&.&&&")                 Result: "003,142"

Fstr$(3.142,"***.***")                  Result: "**3,142"

Fstr$(3.142,"$$$.$$$")                  Result: "$$3,142"

Fstr$(3.142,"###.***")                 Result: "  3,142"

Fstr$(5003.1,"#,###.&&")             Result: "5.003,10"

Fstr$(3.142,"#####")                  Result: "    3"