Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3591 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello,

 

I am a FM newbie and have been scouring the web for an answer to this problem:

 

I want to eliminate the text within parentheses in a string, but I want to eliminate all instances:

 

ORIGINAL STRING:

This is a test of the (emergency) broadcast system. (It is only a test). Remain calm.

 

DESIRED STRING: 

This is a test of the broadcast system. Remain calm.

 

Can anyone help?

 

Also, is it possible to tie the function or script to a field so that when the ORIGINAL string is put into the field, the field does the conversion automatically?

 

thanks very much in advance,

 

SB

Posted
I want to eliminate the text within parentheses in a string,

 

If you eliminate all text within parentheses, you will end up with:

"This is a test of the  broadcast system. . Remain calm."

You can clean up the runs of spaces by using TrimAll() on the result, but the extra period in your example is outside the parentheses.

 

 

This would probably be best done with a custom recursive function, but you can try a hack in the form of:

Let (
formula = Substitute ( Quote ( Textfield ) ; [ "(" ; ""  & /*" ] ; [ ")" ; "*/ "" ] )
;
Evaluate ( formula )
)

Note that this will fail miserably if the text contains unbalanced parentheses.

 

 

Also, is it possible to tie the function or script to a field so that when the ORIGINAL string is put into the field, the field does the conversion automatically?

 

You can set the field to auto-enter a calculated value (using the above formula), replacing the existing value.

Posted

Thanks very much, Comment

 

I am going to play with that right now

 

Much appreciated!

 

SB

Posted

Very clever approach, comment!  Agree that a recursive function is probably the way SB should go, but I love the lateral thinking that went into your approach.

 

Mark

This topic is 3591 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.