C1Awk Reference > C1Awk Properties > F Property |
Returns or sets the value of a field within the current line.
[form!]C1Awk.F(index As Integer)[ = value As String ]
Awk fields are obtained by parsing the contents of the current line (L property) using the symbols defined as field separators (FS property) as delimiters. The parsing is done automatically, and is affected by the settings of the FS, MatchQuotes, and FilterQuotes properties.
Fields are numbered from 1 to NF. As in the Awk language, field 0 corresponds to the whole line (record).
If you try to set or read an invalid field, Awk fires the Error event.
If you set a field to a string that contains field separators, the line is automatically re-parsed, and the NF property is updated.
For example:
awk.F(0) = "This is a string"
Debug.Print awk.NF, awk.F(0)
4 This is a string
Debug.Print awk.F(4)
string
awk.F(4) = "plain long ASCII string"
Debug.Print awk.NF, awk.F(0)
7 This is a plain long ASCII string
String