Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

String manipulation

9 views
Skip to first unread message

Michael Abd-El-Malek

unread,
Oct 29, 1999, 3:00:00 AM10/29/99
to
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


Erik Naggum

unread,
Oct 29, 1999, 3:00:00 AM10/29/99
to
* 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

Michael Abd-El-Malek

unread,
Oct 29, 1999, 3:00:00 AM10/29/99
to
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
0 new messages