15 lines
330 B
Text
15 lines
330 B
Text
MODULE Palindrome;
|
|
|
|
IMPORT Text;
|
|
|
|
PROCEDURE isPalindrome(string: TEXT): BOOLEAN =
|
|
VAR len := Text.Length(string);
|
|
BEGIN
|
|
FOR i := 0 TO len DIV 2 - 1 DO
|
|
IF Text.GetChar(string, i) # Text.GetChar(string, (len - i - 1)) THEN
|
|
RETURN FALSE;
|
|
END;
|
|
END;
|
|
RETURN TRUE;
|
|
END isPalindrome;
|
|
END Palindrome.
|