The function CONDENSE with the addition of NO-GAPS is used to remove the space in the text.
Sample:
DATA: inputText(20) VALUE ' Testing 1 2 3 ... ',
length TYPE I.
length = STRLEN( inputText ).
WRITE: 'Input :' , inputText.
WRITE: / 'Length: ', length.
* Use CONDENSE to remove the leading and trailing spaces.
CONDENSE inputText .
length = STRLEN( inputText ).
WRITE: 'Input :' , inputText.
WRITE: / 'Length: ', length.
* Use CONDENSE .. NO-GAPS to remove the spaces in between words in the text .
CONDENSE inputText NO-GAPS.
length = STRLEN( inputText ).
WRITE: 'Input :' , inputText.
WRITE: / 'Length: ', length.
Output:
Input: Testing 1 2 3 ...
Length: 19
Input:Testing 1 2 3 ...
Length: 17
* leading and trailing spaces has been removed.
Input:Testing123...
Length: 13
*Spaces in between the words in the text has been removed.
This comment has been removed by a blog administrator.
ReplyDelete