Removing brackets

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hello - I need to remove parts of text from a string (I'm using Crystal Reports X) where the part that needs removing is contained within brackets AND I also need to remove the brackets. As an example:

The white rabbit (white rabbit)

So in the example above I need to remove (white rabbit)

I have tried

replace({Field.String},"(*)","")

but that has no effect at all i.e. nothing changes.

Any ideas please?
first you have to verify that the only time () is used in the string is where you want to remove the content. If the part you want to remove is always at the end of the string you can
use instr() to find the placement of the "(" and then left() on that field with the result something like this

if instr({Field.string},"(")>0 then
rtrim(left({Field.string},instr({Field.string},"(")-1)) else {Field.string}
Thank you - that works a treat!