Class TAwkParser (unit MiniAwk) |
TObject
15feb96 kci -- develop TAwkParser, a simple awk-like line parser notes 24feb96 kci This awk object is but a limited subset of a real awk system, but does provide the basic "parse-input-into-fields" that is a key part of awk. Example using MiniAwk: var arg: TAwkParser; ... arg := TAwkParser.Create; arg.FS := ';'; // otherwise FS defaults to '', which matches any number of spaces arg.Parse('any text; to be parsed; on the FS delimiter'); // arg.CreateParse(';', 'any text; ...'); // would be equivalent to get to this point write('the entire input string was "' + arg[0] + '"'); for i := 1 to arg.NF do write('field #' + i + ' is "' + arg[i] + '"'); arg.Free; Possible directions: * support stream i/o * re-parse if any input field is assigned-to * support regular expressions * support other awkish behavior
Constructors |
Functions |
Properties |
Events |
Variables |
Constructors |
Functions |
count[n] is assumed to contain a valid count, at least 1!
Properties |
Events |
Variables |