FUSING

Top  Previous  Next

Action

Formats a floating point value.

 

 

Syntax

var = Fusing( source, mask)

 

 

Remarks

Var

The string that is assigned with the result.

Source

A variable of the type single that must be formatted.

Mask

The formatting mask . ###.##

The # sign is used to indicate the number of digits before and after the decimal point. Normal rounding is used.

 

When you don't need rouding the result, use the & sign instead of the # sign after the point.

 

When you want leading zero's use the 0 character before the point.

 

See also

STR

 

 

Example

Dim S As Single , Targ As String * 16

'The FUSING() function formats a single into a string in order to 'represent it better without all the digits after the point

 

 

'assign single

S = 99.4999

Targ = Fusing(s , ##.#)

Print Targ

'with the # mask, you can provide the number of digits before and after 'the point

'the result should be 99.5

 

 

'with a 0 before the point, you can indicate how many digits you want to 'have filled with zeros

Targ = Fusing(s , 000.#)

'the result should be 099.5

 

'When you dont want that the result is rounded, you can use the & indicator

 

Targ = Fusing(s , 000.&&)

'result should be 099.49

 

'note that if the number of digits you provide is not enough to store the 'result result is extended automaticly

 

'Also note that the - sign will use one digit of the mask too

 

S = -99.12

Targ = Fusing(s , 00.&&)

'result is -99.12

End