ALGOL 68/prelude: Difference between revisions
Content added Content deleted
(Removed Category:ALGOL 68 so it isn't counted as a "task") |
(→string in string: bugfix) |
||
Line 63: | Line 63: | ||
BOOL found := FALSE; |
BOOL found := FALSE; |
||
CHAR first char = s[ LWB s ]; |
CHAR first char = s[ LWB s ]; |
||
⚫ | |||
⚫ | |||
INT s length = ( UPB s - LWB s ) + 1; |
INT s length = ( UPB s - LWB s ) + 1; |
||
⚫ | |||
⚫ | |||
WHILE NOT found AND first pos <= end pos DO |
WHILE NOT found AND first pos <= end pos DO |
||
found := char in string( first char, first pos, t[ first pos : @ first pos ] ); |
found := char in string( first char, first pos, t[ first pos : @ first pos ] ); |
||
Line 71: | Line 71: | ||
# the first character is not present # |
# the first character is not present # |
||
first pos := end pos + 1 |
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 |
ELIF s = t[ first pos : first pos + ( s length - 1 ) ] THEN |
||
# found the full string s at first pos # |
# found the full string s at first pos # |