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...

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.