Application Development 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: 

Strings

Former Member
0 Kudos

DATA text TYPE string VALUE `I know you know`.

SHIFT text RIGHT DELETING TRAILING 'no kw'.

O/P : " I know you"

Can You Explain This....How?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

this statement will shift the string char by char for the length of comparing string number of times.if the char each time shifting right is present in the pattern it will delete and continue. else it will stop.

in this example.length of comparing string('no kw') = 4(including space)

1st right shift char is 'W' it is there in 'no kw' so it will delete and continue.

2nd right shift char is 'O' it is there in 'no kw' so it will delete and continue.

3rd right shift char is 'N' it is there in 'no kw' so it will delete and continue.

4th right shift char is 'K' it is there in 'no kw' so it will delete and continue.

5th right shift char is ' ' it is there in 'no kw' so it will delete and continue.

6th right shift char is 'U' it is not there in 'no kw' so it will stop.

rgds,

bharat.

2 REPLIES 2

Former Member
0 Kudos

Hi,

DATA text TYPE string VALUE `I know you know`.

SHIFT text RIGHT DELETING TRAILING 'ownk'.

write:/ text.

It's deleting the word containing of the alphabets k,n,o,w.

Even try for the above example.

Bye,

KC

Former Member
0 Kudos

HI,

this statement will shift the string char by char for the length of comparing string number of times.if the char each time shifting right is present in the pattern it will delete and continue. else it will stop.

in this example.length of comparing string('no kw') = 4(including space)

1st right shift char is 'W' it is there in 'no kw' so it will delete and continue.

2nd right shift char is 'O' it is there in 'no kw' so it will delete and continue.

3rd right shift char is 'N' it is there in 'no kw' so it will delete and continue.

4th right shift char is 'K' it is there in 'no kw' so it will delete and continue.

5th right shift char is ' ' it is there in 'no kw' so it will delete and continue.

6th right shift char is 'U' it is not there in 'no kw' so it will stop.

rgds,

bharat.