Karbon wrote:It is early and I haven't had my coffee yet but I don't see any benefit over the built in StringField() function?
HI
Karbon
TRY IS CODE, change idea.
thanks dom....
sorry my english...
Code: Select all
Procedure.s stringfield2(var$,indice,p$)
lp=Len(p$)
bak=1
Repeat
x=FindString(var$+p$,p$,bak+1)
If x
c+1
If c=indice
ProcedureReturn Mid(var$,bak,x-(bak))
EndIf
bak=x+lp
EndIf
Until x=0
EndProcedure
a$="123456789stop123456789stoppurebasicstopisstopcool"
;using STRINGFIELD NORMAL
Debug StringField(a$,1,"stop")
Debug StringField(a$,2,"stop")
Debug StringField(a$,3,"stop")
Debug StringField(a$,4,"stop")
Debug StringField(a$,5,"stop")
Debug StringField(a$,6,"stop")
Debug StringField(a$,7,"stop")
Debug StringField(a$,8,"stop")
Debug StringField(a$,9,"stop")
;using STRINGFIELD2 MODIFIED
Debug StringField2(a$,1,"stop")
Debug StringField2(a$,2,"stop")
Debug StringField2(a$,3,"stop")
Debug StringField2(a$,4,"stop")
Debug StringField2(a$,5,"stop")
Debug StringField2(a$,6,"stop")
Debug StringField2(a$,7,"stop")
Debug StringField2(a$,8,"stop")
Debug StringField2(a$,9,"stop")