Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Replace String

Former Member
0 Likes
738

Hi all,

There are some string like these ;

aaa-bbb--ccc

aabbbb---cc

aaaabbccc

.....

how can replace - or -- or ---or -


or -


with one space? Could you send me the algorithm?

Best regards,

Munur

5 REPLIES 5
Read only

anuj_srivastava
Active Participant
0 Likes
688

Hi Munur ,

you can use the command Replace all occurrences of.

let ur string be str = 'aabb-cc--'.

REPLACE ALL OCCURRENCES of '-' in str with space.

This can solve ur problem.

Regards,

Anuj

Read only

Former Member
0 Likes
688

use statement

Replace all occurence of '-' in <your field> with space.

If the above single statement gives you too many spaces use the following lines.

Replace all occurence of '----' in <your field> with space.

Replace all occurence of '---' in <your field> with space.

Replace all occurence of '--' in <your field> with space.

Replace all occurence of '-' in <your field> with space.

This will definitely serve your purpose.

Regards,

Lalit Mohan Gupta.

Read only

Former Member
0 Likes
688

Hi.

Use:

REPLACE ALL OCCURRENCES OF '-' IN str WITH SPACE.

and later, if you wish just ONE space,

CONDENSE str.

Read only

0 Likes
688

Hi,

You can use regular expressions for that:

REPLACE ALL OCCURRENCES OF REGEX '-*' IN <your_string> WITH <replacement>.

This will replace caracters '-', '', '-', etc. in you string by the replacement string you specified.

Hope it helps.

Regards,

Tanguy

Read only

Former Member
0 Likes
688

Enough.

Rob