String matching: Difference between revisions

Forth
mNo edit summary
(Forth)
Line 85:
int loc=s2.find(s3)//returns 0
loc=s2.find(s3,loc+1)//returns 2</lang>
 
=={{header|Forth}}==
<lang forth>: starts-with ( a l a2 l2 -- ? )
tuck 2>r min 2r> compare 0= ;
: ends-with ( a l a2 l2 -- ? )
tuck 2>r negate over + 0 max /string 2r> compare 0= ;
\ use SEARCH ( a l a2 l2 -- a3 l3 ? ) for contains</lang>
 
=={{header|J}}==
Anonymous user