Restored from previous forum. Originally posted by Fangbeast.
Hi folks, I really hate to ask for help but...I'm trying to make a simple-as-possible FindFirst/Findnext string searching logic which I will use with linked lists (or anything else for that matter).
I've been at this for 3 days but don't know where I am going wrong (and head hurts like hell now). Anybody with a brain out there who could help me?? I'm about to pack mine in a sandwich!!!
Fangles
FindFirst/FindNext logic
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
...,
Can you give an input / output example of hat you would like ?
Would something like the following help you ?
;**********************************************************************
Procedure.s FindAll(a$, b$)
c$ = a$
d$ = ""
While FindString(c$, b$, 1) 0
iu = FindString(c$, b$, 1)
c$ = Mid(c$, iu + 1, Len(c$) - iu - 1 + 1)
d$ = d$ + Str(iu + oldiu) + " "
oldiu = iu + oldiu
Wend
d$ = StripLead(StripTrail(d$))
ProcedureReturn d$
EndProcedure
;
;
;
OpenConsole()
PrintN(FindAll("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway", "o"))
PrintN(FindAll("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway", "an"))
PrintN(FindAll(LCase("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway"), "the"))
While Inkey() = ""
Wend
CloseConsole()
End
;**********************************************************************
Rgrds
Francois Weil
14, rue Douer
F64100 Bayonne
...,
Can you give an input / output example of hat you would like ?
Would something like the following help you ?
;**********************************************************************
Procedure.s FindAll(a$, b$)
c$ = a$
d$ = ""
While FindString(c$, b$, 1) 0
iu = FindString(c$, b$, 1)
c$ = Mid(c$, iu + 1, Len(c$) - iu - 1 + 1)
d$ = d$ + Str(iu + oldiu) + " "
oldiu = iu + oldiu
Wend
d$ = StripLead(StripTrail(d$))
ProcedureReturn d$
EndProcedure
;
;
;
OpenConsole()
PrintN(FindAll("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway", "o"))
PrintN(FindAll("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway", "an"))
PrintN(FindAll(LCase("The quick brown fox jumps over the lazy dog ... and my taylor is reach anyway"), "the"))
While Inkey() = ""
Wend
CloseConsole()
End
;**********************************************************************
Rgrds
Francois Weil
14, rue Douer
F64100 Bayonne
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Fangbeast.
Might be easier to just send you the code than try to explain this mess:(...,
Can you give an input / output example of hat you would like ?
Rgrds
Francois Weil
14, rue Douer
F64100 Bayonne
Code: Select all
Fangles