- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get all occurrences of the string between any two specific characters in SAP ABAP
I usually use REGEX in all such cases as it is faster and easily readable and would recommend the same to you.
You can use something similar as the snippet to get your job done.
DATA: lv_para TYPE string. lv_para = ' You &are like& kite &flying& in a &hurricane&'. REPLACE ALL OCCURRENCES OF REGEX '&[^&]+&' IN lv_para WITH ''. WRITE lv_para.
Let me explain the regex for you. It should match the first ‘&’, then you can have any combination with multiple occurrences of ‘&’ and the last occurrence of ‘&’ must be matched.
Advertisements