For you VBers, Delphi is a derivative of Pascal...it's powerful, simple, and (best of all) doesn't need external component (eg: ocx files).
Hence the code:
Code:
function TForm1.SimpleParse(MainString, BeginString, EndString: string): string;
var
PosBeginString: integer;
PosEndString: integer;
begin
PosBeginString := Pos(BeginString, MainString) + Length(BeginString);
PosEndString := Pos(EndString, MainString);
Result := Copy(MainString, PosBeginString, PosEndString - PosBeginString);
end;
For example, the code:
Code:
ShowMessage(SimpleParse('The quick brown fox jumped over the lazy dog.', 'brown', 'jumped'));
...will return the string: ' fox '
Notes:
1) The instance variables PosBegin/EndString aren't needed if you replace their assigned values in the actual Copy function.
2) You don't necessarily need the function to parse. You can take those three lines (or single line) of code and put it in a procedure.
That is all. I may make a parsing function that parses multiple items in the future.
Enjoy.

