[Zope] Extracting a part of a string

sbergmann@weblog.de sbergmann@weblog.de
Fri, 29 Jun 2001 15:56:45 +0200


This is a multipart message in MIME format.
--=_alternative 004C6697C1256A7A_=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello Zopers,

I have the following problem:

I have a string from a database and want to delete a part from the string=20
and write it back to the database.

An example:

a =3D ' some words ( another words)'
I want to extract now everything without the brackets themselves anth the=20
words in the brackets.
That should be the result.

a =3D 'some words'

How can I do that. With the string-module and "find"  I can get the index=20
where the brackets begin. But there is no function to get the string from=20
index 0 to the result  index of "find".

Is there another way to do this?

I=B4m sure that somebody has a solution for me.


Steffen
--=_alternative 004C6697C1256A7A_=
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable




<br><font size=3D2 face=3D"sans-serif">Hello Zopers,</font>
<br>
<br><font size=3D2 face=3D"sans-serif">I have the following problem:</font>
<br>
<br><font size=3D2 face=3D"sans-serif">I have a string from a database and =
want to delete a part from the string and write it back to the database.</f=
ont>
<br>
<br><font size=3D2 face=3D"sans-serif">An example:</font>
<br>
<br><font size=3D2 face=3D"sans-serif">a =3D ' some words ( another words)'=
</font>
<br><font size=3D2 face=3D"sans-serif">I want to extract now everything wit=
hout the brackets themselves anth the words in the brackets.</font>
<br><font size=3D2 face=3D"sans-serif">That should be the result.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">a =3D 'some words'</font>
<br>
<br><font size=3D2 face=3D"sans-serif">How can I do that. With the string-m=
odule and &quot;find&quot; &nbsp;I can get the index where the brackets beg=
in. But there is no function to get the string from index 0 to the result &=
nbsp;index of &quot;find&quot;.</font>
<br>
<br><font size=3D2 face=3D"sans-serif">Is there another way to do this?</fo=
nt>
<br>
<br><font size=3D2 face=3D"sans-serif">I=B4m sure that somebody has a solut=
ion for me.</font>
<br>
<br>
<br><font size=3D2 face=3D"sans-serif">Steffen</font>
--=_alternative 004C6697C1256A7A_=--