RosettaCodeData/Task/String-matching/Phixmonti/string-matching-2.phixmonti
2023-07-01 13:44:08 -04:00

22 lines
496 B
Text

/# Rosetta Code problem: https://rosettacode.org/wiki/String_prepend
by Galileo, 11/2022 #/
include ..\Utilitys.pmt
"the last thing the man said was the" "the" pstack
( ) rot rot >ps
true while
tps find dup >ps
if swap tps 0 put swap 32 ps> set true else ps> endif
endwhile
len ps> len nip - 1 + >ps drop
len for get
dup 1 == if "Begins with keyword" ? drop else
dup tps == if "Ends with keyword" ? drop else
"Locate at position " print ?
endif endif
endfor
ps> drop