DIAdem Help

Method: ParseString for Formatter

  • Updated2024-09-12
  • 2 minute(s) read

Method: ParseString for Formatter

Parses a text into the specified data type.

vParseString = Object.ParseString(sPString, eDataType)

ObjectFormatter
Object with this method
sPStringString
Specifies the text to convert.
eDataType Specifies the data type.
Enumeration with the following selection terms:
0 eNoType Not defined
eI8 8-bit integer values
2 eI16 16-bit integer values
3 eI32 32-bit integer values
4 eI64 64-bit integer values
5 eByte Byte
6 eU16 16-bit unsigned integer
7 eU32 32-bit unsigned integer
8 eU64 64-bit unsigned integer
9 eR32 32-bit real values
10 eR64 64-bit real values
23 eString Text
24 eEnum Enumeration
30 eTime Time values
vParseStringVariant
Receives the converted text.
Note  If the text is converted to a numeric type, only the first number in the text is used. If the text does not contain a number, the return value is NULL.
Note  The conversion uses the current format.
Note  If the data types eU16 or eU32 are returned, the return value ConvString can cause problems in VBS.

The following example shows how to read strings and to use ParseString to convert the strings into real values.

Dim ChnName   : ChnName = File.GetCharacters(120)
Dim rChnCount : rChnCount= File.Formatter.ParseString(File.GetCharacters(12), eR64)
If IsNull(rChnCount) Then RaiseError
Dim rChnDelta : rChnDelta= File.Formatter.ParseString(File.GetCharacters(24), eR64)
If IsNull(rChnDelta) Then RaiseError
Dim rChnMin   : rChnMin  = File.Formatter.ParseString(File.GetCharacters(24), eR64)
If IsNull(rChnMin) Then RaiseError
Dim oMyGrp    : Set oMyGrp = Root.ChannelGroups.Add("MyChannelGroup")
Dim oMyChn    : Set oMyChn = oMyGrp.Channels.AddImplicitChannel("Time", rChnMin, rChnDelta, rChnCount, eR64)

The following example shows how to read strings and to use ParseString to convert the strings into time values.

Dim oMyDate : Set oMyDate= File.Formatter.ParseString(File.GetCharacters(20), eTime)
If IsNull(oMyDate) Then RaiseError
Call Root.Properties.Add("Year/Month", oMyDate.Year&"/"oMyDate.Month)

See Also

Objects Overview

Examples

Checking DataPlugins for Timeout

Log in to get a better experience