
Section 11. String Functions
FormatFloat (Float, FormatString)
Converts a floating point value into a string.
Syntax
String = FormatFloat (Float, FormatString)
Remarks
The string conversion of the floating point value is formatted based on the
FormatString. Total field width includes decimal point and sign.
Other ASCII characters can be included in the FormatString.
(example: FormatFloat(Variable,"The current reading is %2.3G")
Parameter
& Data Type
Enter
FORMATFLOAT PARAMETERS
Float
Variable or
constant
The Float parameter is the variable or constant that holds the floating point
value to be converted.
Option
Constant as
String
The FormatString determines how the floating point value will be represented
in the converted string. Note that the format string must be enclosed in quotes.
The options are (m = mantissa; d = decimal; x = exponent):
Option
"%e" Decimal notation in the form of +m.dddddd e+xx; precision is 6
places to the right of the decimal.
"%f"
ecimal notation in the form of +mmm.dddddd; p
ecision is 6
laces to the right of the decimal.
"%g"
antissa and decimal are variable; trailing 0s and decimals are
mitted.
"%Y.Zf"
ecimal notation in the form of +m.d; precision is defined by Y
laces to the left of the decimal and Z places to the right of decimal.
"%Ye"
ecimal notation in the form of +m.d e+xx; precision is defined by
characters to the right of the decimal
"%Yg"
antissa and decimal are variable; precision is defined by Y
InStr (Start, SearchStr, SoughtString, SearchOption )
The InStr instruction is used to find the location of a string within a string.
Syntax
Variable = InStr (Start, SearchString, SoughtString, SearchOption )
Remarks
This instruction returns the integer position of the SoughtString parameter. If
the SoughtString is not found, the instruction returns 0.
11-4
Komentarze do niniejszej Instrukcji