•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Legacy and Other Languages section within the Software Development category of DaniWeb, a massive community of 455,967 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,740 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Legacy and Other Languages advertiser: Programming Forums
Views: 866 | Replies: 1
![]() |
•
•
Join Date: May 2006
Posts: 17
Reputation:
Rep Power: 3
Solved Threads: 0
I am trying to find the number of times that one string is found in another string. I tried using (string= "x" "xyzx"), but of course that stops after the first match. If I put this into a loop, how would I define how to escape? Is there a way to specify that the end of the string has been reached? Is there a better way to do this? Thanks...
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation:
Rep Power: 13
Solved Threads: 193
I don't know Lisp, but I do know Scheme. Write yourself a little recursive function that does the job. I would use an index into the string to keep the original string reference (instead of recursively operating on copies of substrings). When you run out of string, then you've found all the matches.
You might find the stuff at the CL Cookbook useful. Particularly the (search ...) function.
Hope this helps.
You might find the stuff at the CL Cookbook useful. Particularly the (search ...) function.
Hope this helps.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Legacy and Other Languages Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Lisp Load Function (Computer Science and Software Design)
- What's the HARDEST program you've written? (Computer Science and Software Design)
- A multilingual coded Hello World! thread (Legacy and Other Languages)
- Lisp question (Legacy and Other Languages)
- please help me: build a binary search tree by Lisp (Legacy and Other Languages)
- Newbie Queston About LISP (Legacy and Other Languages)
- Lisp help - is this function right? (Legacy and Other Languages)
- Running a program (C++)
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: QBASIC and Visual Basic
- Next Thread: A multilingual coded Hello World! thread



Linear Mode