We use the SPLIT keyword to SPLIT a string by a delimiter. If the delimiter is in the middle of the string (that is, if the first and last characters are not delimiters), we can easily see the result. But what if the delimiter is exactly the first or last of the string?
In the debug window, you can see all the row items in the inner table LT_SPLIT_TABLE after line 6 is executed, as shown in the following code.
In the debug window, you can see all the row items in the inner table LT_SPLIT_TABLE after line 6 is executed, as shown in the following code.
DATA: lv_str TYPE string,
lt_split_table TYPE TABLE OF string.
lv_str = '/This/is/a/test./'.
SPLIT lv_str AT '/' INTO TABLE lt_split_table.
From the above test results, when the separator is at the beginning of the string, the left side of the separator will split an empty string; When a delimiter is at the end of a string, the empty string is not split to the right of the delimiter.
DATA: lv_str TYPE string,
lt_split_table TYPE TABLE OF string,
ls_split_table TYPE string.
SPLIT lv_json AT '[' INTO str1 str2.
SPLIT str2 AT ']' INTO TABLE lt_split_table.
LOOP AT lt_split_table INTO ls_split_table.
IF sy-tabix <> sy-tfill. "The last line is not involved in splicing
CONCATENATE str3 ls_split_table INTO str3 .
ENDIF.
ENDLOOP.
CONCATENATE '[' str3 ']' INTO o_return5 .
This splits str2 according to ‘] ‘, then removes the last one and splits it together.
This is one way to SPLIT a SPLIT from the right.
Read More:
- How to use Python split() function (split array)
- Java String.split () special character processing
- Environment configuration at the beginning of OpenCV + vs2015
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- [!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.
- About Java File.separator
- In Java, int is converted to string, and zero is added before the number of bits is insufficient
- Project files may be invalid appears when cmake compiles opencv3.1, and the debug additional dependency of the compiled opencv3.1 is at the end
- The method of removing special characters in ABAP
- XML file should have root tag (extra content at the end of the document in file error)
- Split screen display method in IntelliJ idea
- Golang Warning: Error string should not be capitalized or end with punctuation mark
- The solution cannot be separated due to a special separator
- TSLint:object access via string literals is disallowedtslint(no-string-literal)
- String operation to delete the character at the specified position
- error Newline required at end of file but not found eol-last
- error: expected declaration or statement at end of input
- Gcc compiler warning solution: “extra tokens at end of ifndef directive” Tags: GCC, warning
- C language error: expected declaration or statement at end of input
- How to Split numbers and strings in a strings