Online Tutorials & Training Materials | STechies.com
Register Login

Insert space between every 3 numbers in the string.

|| 0

Insert space between every 3 numbers in the string.
Stechies

1) How to insert space between every 3 numbers in the string?

 please help me to insert space between every 3 numbers in the string using concatenate command.

 eg: string: 100838490382

 expected output : 100 838 490 382

Solution

v_temp1 = str+0(3).

v_temp2 = str+3(3).

v_temp3 = str+6(3).

v_temp4 = str+9(3).

CONCATENATE v_temp1 v_temp2 v_temp3 v_temp4 INTO v_string SEPARATED BY SPACE.

2) How to Add Space Before a String Variable?

 eg: string: '90'
 expected output:' 90'

Solution

In order to add spaces before string please use the SHIFT statement as shown below:

Data : Var(10) type c value 'ABC'.

SHIFT VAR BY 1 PLACES LEFT.

WRITE:/ VAR.