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

Replacing Text with Spaces

Former Member
0 Likes
578

What is the fewest lines of code needed to transform:

'this is a test--have a look'

with

'this is a test'

the idea is to find the '--' in the string and blank out everything after that.

Thank-You

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
553

How though was it ?

DATA: lv_low TYPE string VALUE 'this is a test--have a look',
      lv_c(35) TYPE c.

SPLIT lv_low AT '--' INTO lv_low lv_c.
CLEAR lv_c.

CONCATENATE lv_low lv_c INTO lv_low.

WRITE lv_low.

5 REPLIES 5
Read only

Former Member
0 Likes
553

1

Rob

Read only

0 Likes
553

Rob, I try to use this forum quite seriously. If my question was incomplete you can let me know.

Otherwise, I suggest you read "The Rules of Engagement"

Step 5: Answering a question

The community lives by people like you, trying to help others. When you see an unanswered question where you think you can answer, do so and help the poster. Remember to be polite and if you do not completely understand a question and need more details, request more information from the poster.

Thank-You.

Read only

0 Likes
553

>

> Rob, I try to use this forum quite seriously. If my question was incomplete you can let me know.

>

> Otherwise, I suggest you read "The Rules of Engagement"

>

> Step 5: Answering a question

> The community lives by people like you, trying to help others. When you see an unanswered question where you think you can answer, do so and help the poster. Remember to be polite and if you do not completely understand a question and need more details, request more information from the poster.

>

> Thank-You.

Good point - let me explain

I don't think the rules of engagement say this, (at least I don't see it) but if you expect a good answer, you have to ask a good question. I think that if you check, you'll see that my answer completely and correctly answers the question that you actually asked. (I tested it.)

But to be fair, my answer was meant to ask to think about what you are asking and why you are asking such a question. Is your server so limited in storage space that you have to be concerned about the physical size of programs. Or is the question meant to be performance related? Or something else entirely?

But also to be fair, you have asked almost 500 questions and seem to be asking the forum a question that you really ought to think about yourself. Those rules of engagement also talk about searching for a solution before asking and explaining what you have done to find a solution in your question.

Rob

Read only

0 Likes
553

What is the fewest lines of code needed to transform:

I think the exact answer is 1 LOC ( Lines of code) as said by Rob.

@Tom - Its a FAQ, you should have searched.

Read only

former_member156446
Active Contributor
0 Likes
554

How though was it ?

DATA: lv_low TYPE string VALUE 'this is a test--have a look',
      lv_c(35) TYPE c.

SPLIT lv_low AT '--' INTO lv_low lv_c.
CLEAR lv_c.

CONCATENATE lv_low lv_c INTO lv_low.

WRITE lv_low.