WORKING-STORAGE SECTION.
01 InputString Pic X(20).
01 TrimString Pic X(20).
01 TrimCount Pic 9(2).
PROCEDURE DIVISION.
move 'poiuytrewq ' to InputString
move zero to TrimCount
inspect function reverse (InputString) tallying TrimCount for leading space
compute TrimCount = (length of InputString) - TrimCount
move InputString (1:TrimCount) to TrimString
Enjoy!
No comments:
Post a Comment