StringScan - method of the Pm object
Description:
Reading data from the string formatted in the C language convention.
This method is obsolete (but functional) and it is better to use the
PmFormat.Scan method.
Syntax:
Array StringScan(String sFormat, String sSource)
Parameters:
sFormat | (String) Formatting rule written in the C language convention. See C language formatting rule. For real numbers the number of decimal places mustn't be stated (instead of "%5.2f" must be only "%5f"). |
sSource | (String) string from which data are read according to the format |
---|
Return values:
This data are returned by the method in the array of values.
Note:
This method is functional also in
Macro expression $.expr and in the
onDraw event of the
PmgCanvas object.
This method is also functional in
Web panels.
HexaString (a text string in hexadecimal format) can be used in two ways:
1) Display numbers in hexadecimal, where the higher orders are on the left. It corresponds to the storage in memory of
Big-endian. This is the conversion of a number value into the string (and vice versa) using a formatting string. To use
HexaString in this way, it is recommended to use the
PmFormat object.
2) Encoding the contents of a memory section of a certain size (e.g. 1B, 2B, 4B, ...) in hexadecimal. Then it depends on how the number is stored in memory. On
Intel and
AMD processors (
x86 or
x64 architecture), the so-called
Little-endian is used, where the lower orders are on the left. To use
HexaString in this way, it is recommended to use the
PmBuffer object, which can handle both
Little-endian and
Big-endian.
Example:
JavaScriptVBScriptSelect and copy to clipboard
var nTemperature, nPressure;
var sText = "Temperature=25.48, Pressure=112.8";
var aData = Pm.StringScan("Temperature=%5f, Pressure=%5f", sText);
nTemperature = aData.GetItem(0);
nPressure = aData.GetItem(1);
Dim nTemperature, nPressure, sText, aData
sText = "Temperature=25.48, Pressure=112.8"
aData = Pm.StringScan("Temperature=%5f, Pressure=%5f", sText)
nTemperature = aData(0)
nPressure = aData(1)