2006 May 10 10:17 AM
Hi
i need to find out whether the last char of a string is '/' (forward slash). please let me know if there's a FM to do that. Other post me the logic for this ASAP.
thanks
Hi
i need to find out whether the last char of a string is '/' (forward slash). please let me know if there's a FM to do that. Other post me the logic for this ASAP.
thanks
2006 May 10 10:19 AM
len = strlen( v_str ) - 1.
if v_str+len(1) = '/'.
*do something
endif.
2006 May 10 10:22 AM
len = strlen(char).
len = len - 1.
if char+len(1) = '/'.
*write ur code
endif.chk this code
REPORT ychatest.
DATA : str(5) VALUE '123/',
len TYPE i.
len = STRLEN( str ).
len = len - 1.
IF str+len(1) = '/'.
WRITE : '/ found'.
ENDIF.<b>Reward points if helpful and close thrad if solved</b>
Message was edited by: Chandrasekhar Jagarlamudi
2006 May 10 10:23 AM
Hai Ramakrishna
data : v_find type string value 'abcdef/'.
data : v_length type i.
v_length = strlen( v_find ) - 1.
if v_find+v_length(1) = '/'.
write : /'yes'.
else.
write : /'No'.
endif.
Thanks & regards
Sreenivasulu P
Message was edited by: Sreenivasulu Ponnadi
2006 May 10 10:24 AM
Hi Ramakrishna,
The following code snipet will helps your requirement.
data v_string type string.
data v_length type i.
v_length = strlen( v_string).
v_length = v_length - 1.
SEARCH v_string FOR '/' STARTING AT v_length.
if sy-subrc = 0.
write:/ 'Last character is / '.
esle.
write:/ 'Last character is not /'.
endif.
Thanks,
Vinay
2006 May 10 10:24 AM
Equate the string to a char field of equal size.
Find the String length
str2(20) type c.
str2 = string.
n = strlen(string).
m = n - 1.
c = str2+m(1).
2006 May 10 10:27 AM
hi
lastchar can b found using this
len = strlen( yourstring ) .
len = len - 1.
lastchar = yourstring+len(1).
2006 May 10 10:28 AM
hi,
data : n TYPE I.
n = STRLEN( zfield ) - 1.
if zfield+n(1) = '/'.
code
endif
rgds,
latheesh
2006 May 10 11:18 AM
hi Ram,
check the below code.
data: num type i.
data: const1(10) type c value 'thisis/'.
num = strlen( const1 ).
write: num.
num = num - 1.
if const1+num(1) = '/'.
message e000 with 'the last char is /'.
endif.
award pts if helpful.
regards,
keerthi.
2006 May 10 3:16 PM
hi,
after declaring the string variable just fine the string length using <b>strlen</b>. then take the position of the last character of the string into an integer and using <b>offset</b> you can find whether the character in the desired position is '/' or not. the code is as follows :
DATA : STR TYPE string value 'abcde/'.
DATA : POS TYPE i.
POS = STRLEN( a ).
POS = POS - 1.
if STR+POS(1) = '/'.
*WRITE UR CODE HERE
endif.
pls award points if helpful.