2009 Sep 15 9:03 AM
I have the following string: 1.0000000000000000E+01
I need to find subtring E+01 and delete it from the string.
problem is thet 01 can be anything and changes.
I need an expression that will find a subtring starting E+ and two characters that come after ie 01
<removed_by_moderator>
Edited by: Julius Bussche on Sep 15, 2009 10:31 AM
2009 Sep 15 9:08 AM
split string at 'E' into ch1 ch2.
ch1 is the string that doesnt contain your desired substring.
Hi,
Hope this code will give you an idea of how to do this.
DATA: str TYPE string VALUE '1.00000000000E+02',
result_tab TYPE match_result.
FIND 'E+' IN str RESULTS result_tab.
WRITE:/ str+result_tab-offset.
Regards,
Naga Sai Swapna
2009 Sep 15 9:08 AM
split string at 'E' into ch1 ch2.
ch1 is the string that doesnt contain your desired substring.
2009 Sep 15 9:13 AM
Hi,
Here is the code acc to the requirement...
data:
w_str(30) type c value '1.0000000000000000E+01',
w_off type i.
search w_str for 'E+'.
write: sy-fdpos.
w_off = sy-fdpos.
w_str+w_off(4) = space.
write: w_str.
Regards,
Mdi.Deeba
2009 Sep 15 9:15 AM
Hi,
Try the below code;
Data : str(100) type C value '1.0000000000000000E+01'.
Data : len type i.
len = strlen( str ) - 4.
str = str+0(len).This will solve the problem.
>
> Will award points pls help.
Do not offer points its against [Forum Rules|http://wiki.sdn.sap.com/wiki/x/FgQ].
Regards
Karthik D
2009 Sep 15 9:23 AM
Hi,
Try this,
data: w_var1(10) type C value '100E+01',
var1(10) type c,
var2(10) type c.
if w_var1 CS 'E+'.
Split w_var1 at 'E+' into var1 var2.
Endif.
Write: var1, var2.
2009 Sep 15 9:35 AM
Hi,
Try following code
DATA : TEMP TYPE STRING,
CHAR_1(20) TYPE C,
CHAR_2(10) TYPE C.
TEMP = '1.0000000000000000E+01'.
SPLIT TEMP AT 'E+' INTO CHAR_1 CHAR_2.
IF CHAR_2 = '01'.
char_1 contains value you need, you can move this value to the desired internal table.
ENDIF.
Hope this helps.
Edited By Tejaswini Khante
2009 Sep 15 9:44 AM
Hi,
Hope this code will give you an idea of how to do this.
DATA: str TYPE string VALUE '1.00000000000E+02',
result_tab TYPE match_result.
FIND 'E+' IN str RESULTS result_tab.
WRITE:/ str+result_tab-offset.
Regards,
Naga Sai Swapna
2009 Sep 15 9:47 AM
Strange requirement....
1.0000000E+01 is 10
1.0000000E+02 is 100
After deleting the exponent both values are 1.....
If it is to convert a stringrepresantion of a floating number to a number there are better solutions...
2009 Sep 15 9:51 AM
Hi Maksims Jegorovcevs,
Use below code... it will solve your problem... Use offset condence etc while solving this kind of requirement..
PARAMETERS : P_STR(30) TYPE C DEFAULT '1.000000000E+010000000'.
DATA: L_OFFSET TYPE I.
WRITE: / 'INPUT : ' , P_STR.
SEARCH P_STR FOR 'E+'.
L_OFFSET = SY-FDPOS.
P_STR+L_OFFSET(4) = ''.
CONDENSE P_STR NO-GAPS.
WRITE: / 'OUTPUT : ', P_STR.Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |