Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

removing last character of a string

Former Member
0 Kudos
21,738

Hi Gurus,

Is there any way to remove the last character of staring other that finding the string length and doing it?

waiting for reply

Ravi

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
5,744

hi Ravi,

you can SHIFT string RIGHT BY 1.

hope this helps

ec

7 REPLIES 7
Read only

JozsefSzikszai
Active Contributor
5,745

hi Ravi,

you can SHIFT string RIGHT BY 1.

hope this helps

ec

Read only

Former Member
0 Kudos
5,744

Finding String Length and Avoiding Last Character in the string by using offset is the only easy way.

If you know the exact length of the variable value, then you can do offset directly.

Regards,

Satish

Read only

Former Member
0 Kudos
5,744

shift <string> right deleting trailing space.

shift <string> right

Read only

arpit_shah
Contributor
5,744

hi,

SHIFT <string> RIGHT BY 1.

then it will remove last character.

Read only

Former Member
5,744

try this:

w_len = STRLEN( w_rcd ).

w_len = w_len - 1.

w_rcd = w_rcd+0(w_len).

Read only

0 Kudos
5,744

lv_str = reverse( lv_str ).

lv_str = lv_str+1.
lv_str = reverse( lv_str ).
Read only

Sefa_Kurtuldu
Explorer
0 Kudos
5,744

DATA(last_index) = strlen( input ) - 1.

input = input+index(length).

##new input is without last character.