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

delete zero

Former Member
0 Likes
819

Dear experts.

i have a string data '3.1200'

how can i delete the two zero of last.

the result is :'3.12'

Thanks.

Johnmin.

Message was edited by: zhongming LIU

8 REPLIES 8
Read only

Former Member
0 Likes
772

Hi Zhongming,

Use SHIFT command.

Thanks & Regards,

Joseph.

Read only

Former Member
0 Likes
772

Hi,

Use following code to remove last 2 0's.

shift str1 right deleting trailing '0'.

Cheers,

Vikram

Pls reward for helpful replies!!

Read only

Former Member
0 Likes
772

use shift right.

sample code:

DATA : wa_source(7) VALUE '100.400'.

SHIFT wa_source RIGHT DELETING TRAILING '0'.

WRITE: wa_source.

Read only

venkat_o
Active Contributor
0 Likes
772

Hi,

<b>1</b>.

Have a look at this sample code.

DATA :string_x TYPE string VALUE '3.1200',

string_y TYPE string.

string_y = string_x+0(4).

write string_y.

It solves ur problem

<b>Thanks,

Venkat.O</b>

Read only

Former Member
0 Likes
772

DATA : wa_source type string VALUE '3.1200'.

SHIFT wa_source RIGHT DELETING TRAILING '0'.

SHIFT wa_source RIGHT DELETING TRAILING '.'.

Read only

0 Likes
772

Was it really neccessary to dig out this 1 year old post?

Regards

Tamá

Read only

Former Member
0 Likes
772

Hi zhongming LIU,

refer this code :

DATA : wa_source type string VALUE '3.1200'.

SHIFT wa_source RIGHT DELETING TRAILING '0'.

u will get 3.12 as result.

Reward points if helpful.

Regards,

Hemant

Read only

Former Member
0 Likes
772

DATA :x(6) VALUE '3.1200',

y(4) .

y = x.

write y.

or

DATA :x(6) VALUE '3.1200',

y(4) .

y = x+(4).

write y.

Reward if useful.