GetField |
12 |
14 |
16 |
Syntax
GetField [Index],SourceString,
DestinationString,{Delimiter}
Overview
Extracts
a field referenced by Index from a
comma separated SourceString.
The
function returns with it in DestinationString.
Operators
Example
In this example entering a field number 0 to 4 will
display the substring on the terminal.
Dim DestString As String *10
Dim SourceString As String * 30
Dim InputVal As Byte
SourceString = "ABC,DEFG,HIJKL,MNOPQR,STUVWXY"
Loop:
HSerOut["Enter a Field Number ", $0D, ">
"]
L1:
HSerIn 10000, Loop, [InputVal]
If InputVal < $30 Then GoTo L1
If InputVal
> $34 Then GoTo
L1
GetField[InputVal], SourceString,
DestString
HSerOut["Field ", Dec TmpIdx, " Contains ", DestString, $0D, $0D]
GoTo Loop
Stop
Notes
Both Source and Destination variables
must be declared in the calling code. There
are no bounds checks so ensure the destination string is of sufficient size to
accept the longest possible substring.
If the substring returned is longer than the declared destination string
it will overwrite subsequent locations in RAM leading to unpredictable results.