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

Issue with REPLACE Statement

Former Member
0 Likes
394

Hi All,

I have an issue with replace statement . I Would appreciate if someone can throw some light on this

Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code

I want the corresponding values of 4 "&" of text2 in comparsion of Text.

It works fine for every option except for

text2 = '& & & & Class third Field fourth'.

O/p test1 = This first Custom second , test2, test3,test4 are blank

i want o/p like test1 = this

test2 = first

test3 = custom

test4 = second

text2 = 'This first Custom second & & & &'.

O/p test4 = Class third Field fourth , test1, test2,test3 are blank

i want o/p like test1 = class

test2 = third

test3 = field

test4 = fourth

Sorry i tried in code mode but for some reason it doesn't work. It looks messy

Thanks in advance

Edited by: DAVID KITSO on Feb 18, 2010 5:03 PM

Edited by: Rob Burbank on Feb 18, 2010 1:04 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
364

Hi David,

There is a character limitation for posts and as the option code add some HTML, this is rewritten badly... I suggest you to write fewer piece of code nex time in order to have the code well formatted!

For your requirement, the split is done on character '&' so if words are separated by space you will not split correctly words in your 5 variables! I suppose that it is rather your input (variable text2) which is badly formatted in the "wrong" cases...

Best regards,

Samuel

2 REPLIES 2
Read only

Former Member
0 Likes
365

Hi David,

There is a character limitation for posts and as the option code add some HTML, this is rewritten badly... I suggest you to write fewer piece of code nex time in order to have the code well formatted!

For your requirement, the split is done on character '&' so if words are separated by space you will not split correctly words in your 5 variables! I suppose that it is rather your input (variable text2) which is badly formatted in the "wrong" cases...

Best regards,

Samuel

Read only

0 Likes
364

use the below code.

REPLACE ALL OCCURRENCES OF '&' IN text2 WITH space.

split text at space into op1 op2 op3 op4.