The C1Awk Control > Parsing Grid Clip Strings |
You can use the C1Awk's parsing engine with any strings--not only those read from a file. To do this, just assign the string to the L (Line) property, and read the fields one by one.
This is especially useful when you store strings clipped from a grid control. Such strings contain fields separated by line breaks (vbCR) and tabs (vbTab). You can then use two Awk controls, one to split the rows and one to split the columns, like this:
Example Title |
Copy Code
|
---|---|
awk1.FS = vbCR ' to break the string into rows awk2.FS = vbTab ' to break each row into columns awk1 = Clipstring For i = 1 To awk1.NF ' Awk1.NF is the number of rows awk2 = awk1.F(i) ' parse ith line For j = 1 to awk2.NF ' Awk2.NF is the number of columns A(i, j) = Val(awk2.F(j)) Next Next |