Real PowerScript function
Description
Converts a string value to a real datatype or obtains a real
value that is stored in a blob.
Syntax
1 |
<span>Real</span> ( <span>stringorblob</span> ) |
Argument |
Description |
---|---|
stringorblob |
The string whose value you want returned |
Return Values
Real. Returns the value of stringorblob as
a real. If stringorblob is not a valid PowerScript
number or is an incompatible datatype, Real returns
0. If stringorblob is null, Real returns null.
Examples
This statement returns 24 as a real:
1 |
<span>Real</span>("24") |
This statement returns the contents of the SingleLineEdit sle_Temp as
a real:
1 |
<span>Real</span>(sle_Temp.Text) |
The following example, although of no practical value,
illustrates how to assign real values to a blob and how to use Real to
extract those values. The two BlobEdit statements
store two real values in the blob, one after the other. In the statements
that use Real to extract the values, you have
to know where the beginning of each real value is. Specifying the
correct length in BlobMid is not important because
the Real function knows how many bytes to evaluate:
1 |
blob{20} lb_blob |
1 |
real r1, r2 |
1 |
integer len1, len2 |
1 |
1 |
len1 = BlobEdit(lb_blob, 1, 32750E0) |
1 |
len2 = BlobEdit(lb_blob, len1, 43750E0) |
1 |
1 |
// Extract the real value at the beginning and |
1 |
// ignore the rest of the blob |
1 |
r1 = <span>Real</span>(lb_blob) |
1 |
// Extract the second real value stored in the blob |
1 |
r2 = <span>Real</span>(BlobMid(lb_blob, len1, len2 - len1)) |