Advertisement
jargon

token routine from Sparked x86

Sep 12th, 2020
2,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function token(subject as string,sep as string=",",index as string="1") as string
  2.     dim as string buffer,Ln
  3.     dim as long o,t,i
  4.    
  5.     buffer=subject:t=0:i=val(index)
  6.    
  7.     if val(index)>0 then
  8.    
  9.         do
  10.             t=t+1
  11.             o=instr(1,buffer,","):Ln=mid(buffer,o+1):buffer=mid(buffer,o+1)
  12.            
  13.         loop until t=val(index)
  14.        
  15.         token=Ln
  16.        
  17.     elseif index="ct" then
  18.        
  19.         do
  20.             t=t+1
  21.             o=instr(1,buffer,","):Ln=mid(buffer,o+1):buffer=mid(buffer,o+1)
  22.        
  23.         loop until o=0
  24.        
  25.         token=str(t)
  26.    
  27.     end if
  28.    
  29. end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement