<<

Contents

Search

>>

 

STRFORMAT$

 

 

Function

 

 

Syntax:

STRFORMAT$(<Value>,<Format>)

 

<Value>

= <NUM-EXPRESSION>

<Format>

= <STRING-EXPRESSION>

 

 

Meaning:

Formats a numeric value as string in the format <Format>.

 

<Format> specifies the format of the string. Each number must be represented by a character # or $. With the character $ leading zeros are suppressed. The dot is used as decimal point. In the format string <Format> any characters are allowed in addition to $, # and the decimal point. 

 

STRFORMAT$ returns a string that contains as many characters as <Format>. If <Format> is too small for the number <Value>, leading numbers are truncated. 

 

If <Format> is invalid, STRFORMAT$ returns the empty string ²². The variable OK then contains one of the following error numbers:

 

OK

Bedeutung

-1

<Format> contains more than one decimal point.

-2

$ is not valid after the character #.

 

Parameter:

Value

Numeric value

Format

Defines the format of the returned string.

 

Sample:

Function

Result

STRFORMAT$(1234.56,"$$$$.$$")

STRFORMAT$(1234.56,"#####")

STRFORMAT$(1234.56,"#.###")

STRFORMAT$(-1234.56,"#.###")

STRFORMAT$(1234.56,"$$$,$$$.$$")

STRFORMAT$(-1234.56,"###,###.####)

STRFORMAT$(-1234.56,"$$$$.$$")

STRFORMAT$(89552201,"###/## ## ##")

"1234.56"

"01234"

"4.560"

"-.560"

"  1,234.56"

"-01,234.5600"

"-234.56"

"089/55 22 01"

 

See also:

STR$

STR0$

STRN$

STRNUM$

STRVAL$

VAL