Application Development 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: 

removing last character of a string

Former Member
0 Kudos

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

JozsefSzikszai
Active Contributor

hi Ravi,

you can SHIFT string RIGHT BY 1.

hope this helps

ec

7 REPLIES 7

JozsefSzikszai
Active Contributor

hi Ravi,

you can SHIFT string RIGHT BY 1.

hope this helps

ec

Former Member
0 Kudos

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

Former Member
0 Kudos

shift <string> right deleting trailing space.

shift <string> right

arpit_shah
Contributor

hi,

SHIFT <string> RIGHT BY 1.

then it will remove last character.

Former Member

try this:

w_len = STRLEN( w_rcd ).

w_len = w_len - 1.

w_rcd = w_rcd+0(w_len).

0 Kudos

lv_str = reverse( lv_str ).

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

sefak
Discoverer
0 Kudos

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

input = input+index(length).

##new input is without last character.