Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Returns 0-based index of token
#1
QM fellows, do you have any better idea?

Function findtx
Code:
Copy      Help
function# str's str'target

;Returns 0-based index of token.

;Example
;;
;str s="jan feb mar apr"
;
;str target="mar"
;
;out findtx(s target) ;;2

for int'i 0 100
,str s1.gett(s)
,if(s1=target) ret i;; 0-based index of token
,if(empty(s1)) ret -1;; Not found


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)