REM Сравнение строк с игнорированием пробелов
DECLARE SUB UP (A$)
DECLARE FUNCTION COMPARE (B$, C$)
PRINT "Введите первую строку"
INPUT "", A1$
PRINT "Введите вторую строку"
INPUT "", A2$
K = COMPARE(A1$, A2$)
IF K = 1 THEN PRINT "Первая строка 'больше'"
IF K = -1 THEN PRINT "Первая строка 'меньше'"
IF K = 0 THEN PRINT "Обе строки равны"
END
FUNCTION COMPARE (B$, C$)
DIM B1$, C1$
UP B$: UP C$
FOR J = 1 TO LEN(B$)
IF MID$(B$, J, 1) <> " " THEN B1$ = B1$ + MID$(B$, J, 1)
NEXT J
FOR J = 1 TO LEN(C$)
IF MID$(C$, J, 1) <> " " THEN C1$ = C1$ + MID$(C$, J, 1)
NEXT J
IF B1$ > C1$ THEN COMPARE = 1
IF B1$ = C1$ THEN COMPARE = 0
IF B1$ < C1$ THEN COMPARE = -1
END FUNCTION
SUB UP (A$)
FOR J = 1 TO LEN(A$)
SELECT CASE MID$(A$, J, 1)
CASE "a" TO "z": MID$(A$, J, 1) = CHR$(ASC(MID$(A$, J, 1)) - 32)
CASE "а" TO "п": MID$(A$, J, 1) = CHR$(ASC(MID$(A$, J, 1)) - 32)
CASE "р" TO "я": MID$(A$, J, 1) = CHR$(ASC(MID$(A$, J, 1)) - 80)
CASE "ё": MID$(A$, J, 1) = "Ё"
END SELECT
NEXT J
END SUB