I have a table that gets populated with different strings of text. Sometimes there will be lines of text that are surrounded by a "|" (pipe) symbol within them.
For example, This | is a example | line of text
I currently have some coding that will remove the pipe symbols from the text,
DATA: i_TABLE LIKE TABLE.LOOP AT TABLE INTO i_TABLE.REPLACE ALL OCCURRENCES OF '|' IN i_TABLE-FIELD1 WITH ''.MODIFY TABLE FROM i_TABLE.
RESULT: This is a example line of text
What I need to do now is make an exception for a certain category that will only select the text from within the pipes (and remove the pipes)
DESIRED RESULT: is a example
I am not sure how to structure that code. can anyone give me some suggestions?
Are these answers useful?
Help other community members by marking useful answers as accepted.
You can use the split method to break the string into an array and then grab the second occurrence.
var textArray = "This | is a example | line of text".split("|");
var secondText = textArray;
If you need the remove the leading and trailing spaces, and all your users have Reader DC then you can use;