Code: Select all
%str="fivewordswrittenasone"
%sub="words"
!strlen=@len(%str)
!sublen=@len(%sub)
for !i=1 to !strlen-!sublen+1
%piece=@mid(%str,!i,!sublen)
if %piece=%sub then
%return=%piece
exitloop
endif
nextModerators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Code: Select all
%str="fivewordswrittenasone"
%sub="words"
!strlen=@len(%str)
!sublen=@len(%sub)
for !i=1 to !strlen-!sublen+1
%piece=@mid(%str,!i,!sublen)
if %piece=%sub then
%return=%piece
exitloop
endif
nextCode: Select all
!return = @instr(%str,%sub)Code: Select all
%return = @mid(%str,@instr(%str,%sub),@length(%sub))Users browsing this forum: No registered users and 2 guests