‎2009 Apr 07 8:51 AM
Hi there,
I have a very simple question. I have A STRING-variable in my program which contains comma-sperated data (CSV). Now I want to delete the last ";" which is in this line because it is not needed there.
I tried the following, but it doesn't work (syntax error):
* Deletion of the last semicolon in the variable lv_line
lv_length = strlen( lv_line ).
lv_line+lv_length(1) = space.
It seems to be not possible to use offset in combination with a STRING-variable. CHAR I can't use because I don't know how long the char will be.
Is there any easy way to implement such a replacing of the last semicolon in a string?
Kind regards
Markus
‎2009 Apr 07 9:10 AM
You don't want to have the last character right.
then use it this way
declare a new variable of string type
data: v_temp type string.
Deletion of the last semicolon in the variable lv_line
lv_length = strlen( lv_line ).
v_temp = lv_line(lv_length) .
Hope it proves helpful.
‎2009 Apr 07 8:57 AM
what u can do is reverse the string using fm STRING_REVERSE
and use replace first occurence of ';' in our structure with space.
just check the syntax
‎2009 Apr 07 9:02 AM
hi
you use the full stinglengh as offset, but you should substact the last char...
lv_lengh = lv_lengh - 1 .
then replace...
or:
replace all occurances of ';' in string by space
robert
‎2009 Apr 07 9:10 AM
You don't want to have the last character right.
then use it this way
declare a new variable of string type
data: v_temp type string.
Deletion of the last semicolon in the variable lv_line
lv_length = strlen( lv_line ).
v_temp = lv_line(lv_length) .
Hope it proves helpful.
‎2009 Apr 07 9:10 AM