27 lines
861 B
Text
27 lines
861 B
Text
|
|
REM https://github.com/Eva-Broccoli/OPL-Rosetta-Code/blob/main/Substrng.opl
|
||
|
|
PROC main:
|
||
|
|
LOCAL string$(68),i%
|
||
|
|
string$="'Twas brillig, and the slithy toves did gyre and gimble in the wabe."
|
||
|
|
i%=1
|
||
|
|
PRINT "Original string:"
|
||
|
|
PRINT " "+string$
|
||
|
|
PRINT :PRINT "Starting from 7th character and 23 length:"
|
||
|
|
PRINT " "+MID$(string$,7,23)
|
||
|
|
PRINT :PRINT "Starting from 50th character until end of string:"
|
||
|
|
PRINT " "+RIGHT$(string$,1+LEN(strintg$)-50)
|
||
|
|
PRINT :PRINT "Whole string minus the last character:"
|
||
|
|
PRINT LEFT$(string$,LEN(string$)-1)
|
||
|
|
PRINT :PRINT "Starting from character ""h"" and 9 length:"
|
||
|
|
WHILE MID$(string$,i%,1)<>"h"
|
||
|
|
i%=i%+1
|
||
|
|
ENDWH
|
||
|
|
PRINT " "+MID$(string$,i%,9)
|
||
|
|
PRINT :PRINT "Starting from substring ""the"" and 16 length:"
|
||
|
|
i%=1
|
||
|
|
WHILE MID$(string$,i%,3)<>"the"
|
||
|
|
i%=i%+1
|
||
|
|
ENDWH
|
||
|
|
PRINT " "+MID$(string$,i%,16)
|
||
|
|
GET
|
||
|
|
ENDP
|