Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search the string in the opposite direction
#2
Macro Macro3234
Code:
Copy      Help
_s=
;abc
;efg
;hij
;abc
;klm
;abc bbb abc
int pos=sub._Find(_s "abc")
out pos

#sub _Find
function# str's1 $s2

ARRAY(lpstr) a
tok s1 a -1 "[10]" 1
int i
for i a.len-1 -1 -1
,lpstr s3=a[i]
,int j=find(s3 s2)
,if(j>=0) ret s3-s1+j
ret -1


Messages In This Thread
RE: Search the string in the opposite direction - by Gintaras - 08-24-2022, 01:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)