ALGOL 68/prelude: Difference between revisions
→string in string: bugfix
(Removed Category:ALGOL 68 so it isn't counted as a "task") |
(→string in string: bugfix) |
||
Line 63:
BOOL found := FALSE;
CHAR first char = s[ LWB s ];
INT first pos := LWB t;▼
INT end pos = UPB t;▼
INT s length = ( UPB s - LWB s ) + 1;
▲ INT first pos := LWB t;
▲ INT end pos = ( UPB t - s length ) + 1;
WHILE NOT found AND first pos <= end pos DO
found := char in string( first char, first pos, t[ first pos : @ first pos ] );
Line 71:
# the first character is not present #
first pos := end pos + 1
ELIF first pos > end pos THEN
# the first character is present but the rest of the string #
# is too short to contain s #
SKIP
ELIF s = t[ first pos : first pos + ( s length - 1 ) ] THEN
# found the full string s at first pos #
|