27 lines
641 B
Plaintext
27 lines
641 B
Plaintext
include ..\Utilitys.pmt
|
|
|
|
/#
|
|
--(1) starting from n characters in and of m length;
|
|
--(2) starting from n characters in, up to the end of the string;
|
|
--(3) whole string minus last character;
|
|
--(4) starting from a known character within the string and of m length;
|
|
--(5) starting from a known substring within the string and of m length.
|
|
#/
|
|
|
|
def myslice
|
|
rot len var _|long
|
|
rot rot
|
|
over _|long swap - 1 +
|
|
min
|
|
slice
|
|
enddef
|
|
|
|
"the last thing the man said was the"
|
|
10 var n 5 var m
|
|
|
|
n m myslice ? /# (1) #/
|
|
len n swap myslice ? /# (2) #/
|
|
dup -1 del ? /# (3) #/
|
|
'm' find m myslice ? /# (4) #/
|
|
"aid" find m myslice ? /# (5) #/
|