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: 

Need to delete the last 2 character from a string

Former Member
0 Kudos
171

Hi,

I need to delete the last 2 character from a string.

I am using strlen to identify its lenght. If someone can guide how its should be done.

after this two step I tired using

w_string2 = w_string + w_level_03.

w_string = it_cc-prctr.

w_level_03 = strlen( W_STRING ) - 2.

w_string2 = w_string + w_level_03.

the third step is adding the record not deleting the last character/ number from the string.

3 REPLIES 3

Former Member
0 Kudos
139

Replace the following as your Third step.

w_string2 = w_string(w_level_03).

You shud be fine.

Vinodh Balakrishnan

Former Member
0 Kudos
139

Hi,

The following code it to delete the last 2 chars:

str = "testing".

int offset = strlen( str ) - 2.

str = str+0(offset).

Try this if useful.

Thanks & Regards,

Kiran Chennapai

former_member156446
Active Contributor
0 Kudos
139

Hi try this..

w_level_03 = strlen( W_STRING ).

lv_offset = w_level_03 - 2.

w_string2 = w_string +(lv_offset).

or

w_string2 = w_string +0(lv_offset).