User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: May 2006
Posts: 17
Reputation: jaden403 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
jaden403 jaden403 is offline Offline
Newbie Poster

Question Manipulating strings with Common Lisp

  #1  
Nov 18th, 2007
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...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Manipulating strings with Common Lisp

  #2  
Nov 22nd, 2007
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Legacy and Other Languages Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Legacy and Other Languages Forum

All times are GMT -4. The time now is 9:06 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC