From: Edrad
Subject: [Common Lisp] String manipulation
Date: 
Message-ID: <9vhoao$ja4$1@wanadoo.fr>
Hello

I already know the string-concat to concat 2 strings, but I need a function
which can copy a small part of a string

(function "this is a string" 1 4)  => "this"
where 1 would be the beginning index
and 4 the ending index

It would be a function of the kind

function:  string, integer, integer  ->  string
                  s, b, e                               ->  substring of s
from indice b to indice e

The parameters can be different, but I need a function that allow me to
extract substring (even a char) from a string

Thank you a lot

--

Dark Skull Software
http://www.dark-skull.fr.st

A+

From: Knut Anders Hatlen
Subject: Re: [Common Lisp] String manipulation
Date: 
Message-ID: <866677o667.fsf@stjernegris.hatlen.net>
·····@wanadoo.fr wrote:
> Hello
> 
> I already know the string-concat to concat 2 strings, but I need a
> function which can copy a small part of a string
> 
> (function "this is a string" 1 4)  => "this"
> where 1 would be the beginning index
> and 4 the ending index

(subseq "this is a string" 0 4) => "this"

-- 
Knut Anders
From: Matt Curtin
Subject: Re: [Common Lisp] String manipulation
Date: 
Message-ID: <86u1ur2ni6.fsf@rowlf.interhack.net>
>>>>> "Knut" == Knut Anders Hatlen <········@online.no> writes:

  >> I already know the string-concat to concat 2 strings, but I need
  >> a function which can copy a small part of a string

  Knut> (subseq "this is a string" 0 4) => "this"

The original poster would do well to note that this solution uses a
function that applies not specifically to strings, but rather to
sequences.

This is a critical point that often needs to be underscored for folks
only recently enlightened.  It seems to come up a lot with strings.

Strings are sequences.  When working with the Common Lisp library,
you'll frequently find that there isn't a function that does what you
need on the precise type on which you need it to work (e.g., a string)
but there is one that works on a more general type of which your
specific type is a member (e.g., a sequence).

-- 
Matt Curtin, Founder  Interhack Corporation  http://web.interhack.com/
My new book,  "Developing Trust: Online Privacy and Security,"  is now
available.  See site for details.  research | development | consulting
From: Edrad
Subject: Re: [Common Lisp] String manipulation
Date: 
Message-ID: <9vis8g$b7b$1@wanadoo.fr>
Hello

Ok, thanks you for these precisions

--

Dark Skull Software
http://www.dark-skull.fr.st

A+
"Matt Curtin" <········@interhack.net> a �crit dans le message de news:
··············@rowlf.interhack.net...
> >>>>> "Knut" == Knut Anders Hatlen <········@online.no> writes:
>
>   >> I already know the string-concat to concat 2 strings, but I need
>   >> a function which can copy a small part of a string
>
>   Knut> (subseq "this is a string" 0 4) => "this"
>
> The original poster would do well to note that this solution uses a
> function that applies not specifically to strings, but rather to
> sequences.
>
> This is a critical point that often needs to be underscored for folks
> only recently enlightened.  It seems to come up a lot with strings.
>
> Strings are sequences.  When working with the Common Lisp library,
> you'll frequently find that there isn't a function that does what you
> need on the precise type on which you need it to work (e.g., a string)
> but there is one that works on a more general type of which your
> specific type is a member (e.g., a sequence).
>
> --
> Matt Curtin, Founder  Interhack Corporation  http://web.interhack.com/
> My new book,  "Developing Trust: Online Privacy and Security,"  is now
> available.  See site for details.  research | development | consulting
From: Edrad
Subject: Re: [Common Lisp] String manipulation
Date: 
Message-ID: <9vhqc9$4qc$1@wanadoo.fr>
Hello

Thank you !!!!!!!!!!

--

Dark Skull Software
http://www.dark-skull.fr.st

Association d'entraide aux d�veloppeurs francophones
http://www.developpez.com

A+
"Knut Anders Hatlen" <········@online.no> a �crit dans le message de news:
··············@stjernegris.hatlen.net...
> ·····@wanadoo.fr wrote:
> > Hello
> >
> > I already know the string-concat to concat 2 strings, but I need a
> > function which can copy a small part of a string
> >
> > (function "this is a string" 1 4)  => "this"
> > where 1 would be the beginning index
> > and 4 the ending index
>
> (subseq "this is a string" 0 4) => "this"
>
> --
> Knut Anders