RosettaCodeData/Task/String-matching/Phixmonti/string-matching-2.phixmonti

23 lines
496 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
/# 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