194
Platforms
©2000-2008 Tibbo Technology Inc.
dim
s
as
string
s = "192_3.1254.. 30"
'One value has invalid character in it ("_") and "3"
after this character will be ignored. Dot-decimal string. Another value --
1254 -- is out of range. Yet another value is missing and will be replaced
with 0.
s = ddstr(s)
'now s will contain these values: 192, 230, 0, 30.
Ftostr Function
Function:
Converts real value into its string representation.
Syntax:
ftostr(byref num as real, mode as ftostr_mode, rnd as
byte) as string
See Also:
,
,
Part
Description
num
Real value to convert.
mode
Desired output format:
0- FTOSTR_MODE_AUTO: Choose between plain and
mantissa/exponent format automatically. If mantissa/
exponent format results in shorter string it will be used,
otherwise plain format will be used.
1- FTOSTR_MODE_ME: Use mantissa/exponent format.
2- FTOSTR_MODE_PLAIN: Use plain format, not mantissa/
exponent representation.
rnd
Number of digits to round the result to (total number of
non-zero digits in the integer and fractional part of
mantissa).
Details
Ftostr function offers much more control over the format of the output string
compared to similar functions found on other systems. For starters, you can select
whether you want to see mantissa/exponent, "regular" format, or let the function
decide which format to use. Additionally, you control the rounding i.e. get to
choose how many digits should be displayed -- and this influences the
representation both of the fractional and integer part of the value.
Examples below illustrate what you can do with ftostr. The ftostr has a counterpart
-- fstr -- which is invoked implicitly whenever you assign a real to a string
(string=real). Fstr is just like ftostr but mode and rnd parameters are fixed at 0-
FTOSTR_MODE_AUTO and "maximum number of digits possible".
Examples
209
190
207
210