Steve Loft wrote:
I'm using StrReadWord to parse a line of input to my program. If the last 'word' is a single character, then it doesn't get read. Is this behaviour intentional?
No, thanks for the bug report (steve1.pas). It's an easy off-by-one error. Here's a fix which will also be uploaded soon:
--- /home/gpc/src/p/units/stringutils.pas.orig Wed Feb 7 18:16:16 2001 +++ /home/gpc/src/p/units/stringutils.pas Wed Feb 7 18:16:19 2001 @@ -451,7 +451,7 @@ begin StrReadWord := False; StrSkipSpaces (s, i); - if i >= Length (s) then Exit; + if i > Length (s) then Exit; j := CharPosFrom (SpaceCharacters + [','], s, i + 1); if j = 0 then j := Length (s) + 1; if j - i > GetStringCapacity (Dest) then Exit;
Frank