Scan - method of the PmFormat object
Description:
Conversion of a text string to a value according to the specified format.
Syntax:
Variant Scan(String sString)
Parameters:
| sString | (String) Text string that will be converted to a value according to the specified format. |
|---|
Example1:
JavaScriptVBScriptSelect and copy to clipboard
var oFmt = Pm.CreatePmFormat("Type:String;LTxt:N_48_;");
var sVal = oFmt.Scan("N_48_Test");
// sVal = "Test"
Dim oFmt
Set oFmt = Pm.CreatePmFormat("Type:String;LTxt:N_48_;")
Dim sVal
sVal = oFmt.Scan("N_48_Test")
' sVal = "Test"
Example2:
JavaScriptVBScriptSelect and copy to clipboard
var oFmt = Pm.CreatePmFormat("Type:Int;Radix:16;LTxt:0x;");
var nVal = oFmt.Scan("0xB");
// nVal = 11
Dim oFmt
Set oFmt = Pm.CreatePmFormat("Type:Int;Radix:16;LTxt:0x;")
Dim nVal
nVal = oFmt.Scan("0xB")
' nVal = 11
Example3:
JavaScriptVBScriptSelect and copy to clipboard
var oFmt = Pm.CreatePmFormat("Type:Float;LTxt:Temperature ;RTxt:°C;DLen:0;");
var nVal = oFmt.Scan("Temperature 33.6°C");
// nVal = 33.6
Dim oFmt
Set oFmt = Pm.CreatePmFormat("Type:Float;LTxt:Temperature ;RTxt:°C;DLen:0;")
Dim nVal
nVal = oFmt.Scan("Temperature 33.6°C")
' nVal = 33.6