From: Michael Abd-El-Malek
Subject: String manipulation
Date: 
Message-ID: <3818753E.D752BD24@uwaterloo.ca>
Hi, I'm new to LISP and I have a question I suspect stems from my C-eish
ways!  I have a string
"A + (B+C)*(A'+D)"
I need to be able to have that tokenized.  I want the first level to
include the two elements "A" and "(B+C)*(A'+D)".  And then I want to
split the second string from the the middle multiplication sign etc... I
thought I can achieve this by searching for the "+" and "*", but I
haven't been able to find a string-search function in common-lisp
(something like strstr in C, I think).
Is there such a function that can search strings and give me indexes
based on character positions?  I know that strings are just arrays, but
I couldn't find an array function that will let me access all BUT the
first element (ie I could build my own string manipulation routines).
Any pointers/suggestions would be greatly appreciated!
Thanks,
Michael Abd-El-Malek

From: Erik Naggum
Subject: Re: String manipulation
Date: 
Message-ID: <3150161272751691@naggum.no>
* Michael Abd-El-Malek
| Is there such a function that can search strings and give me indexes
| based on character positions?

  see the functions SEARCH, FIND, POSITION.  they operate on sequences,
  which forms the supertype of list, vector, array, and string.  you won't
  find all that many functions specific to strings in Common Lisp, because
  most of the time, they're useful to all sorts of sequences.  this also
  means you use SUBSEQ to extract substrings, and COPY-SEQ to copy strings.

#:Erik
From: Michael Abd-El-Malek
Subject: Re: String manipulation
Date: 
Message-ID: <3818F27A.B556575D@uwaterloo.ca>
Thanks, I now have a lot of experimenting to do with all the tips I've
received!
The LISP community gives great support so far :)
Michael

Erik Naggum wrote:

> * Michael Abd-El-Malek
> | Is there such a function that can search strings and give me indexes
> | based on character positions?
>
>   see the functions SEARCH, FIND, POSITION.  they operate on sequences,
>   which forms the supertype of list, vector, array, and string.  you won't
>   find all that many functions specific to strings in Common Lisp, because
>   most of the time, they're useful to all sorts of sequences.  this also
>   means you use SUBSEQ to extract substrings, and COPY-SEQ to copy strings.
>
> #:Erik