2007 Jul 11 6:53 AM
Hi,
I want to find a length of a string.
This is my program to write the length of a string.But iam getting errors. Plz correct it.
PARAMETERS: P_STR(30) TYPE C.
DATA:
W_LEN TYPE I.
FIND LENGTH OF A STRING
W_LEN = STRLEN(P_STR).
WRITE:/ 'LENGTH OF', P_STR IS', W_LEN.
Thanks.
2007 Jul 11 6:57 AM
Hi,
PARAMETERS: P_STR(30) TYPE C.
DATA:
W_LEN TYPE I.
* FIND LENGTH OF A STRING
W_LEN = STRLEN( P_STR ). " Space after ( and before )
WRITE:/ 'LENGTH OF', P_STR, 'IS', W_LEN." Commas
Regards
Sudheer
2007 Jul 11 6:56 AM
Copy ,paste and execute the code
PARAMETERS: P_STR(30) TYPE C.
DATA:
W_LEN TYPE I.
FIND LENGTH OF A STRING
W_LEN = STRLEN( P_STR ).
WRITE:/ 'LENGTH OF', P_STR ,'IS', W_LEN.
Regards,
Pavan.
2007 Jul 11 7:06 AM
Hi
Try like this its working fine
REPORT ZSTRING .
PARAMETERS: P_STR(30) TYPE C.
DATA:
W_LEN TYPE I.
*STRLEN TYPE XSTRING.
* FIND LENGTH OF A STRING
W_LEN = STRLEN( P_STR ).
WRITE:/ 'LENGTH OF', P_STR ,'IS', W_LEN.
Reward all helpfull answers
Regards
Pavan
2007 Jul 11 6:57 AM
Hi,
PARAMETERS: P_STR(30) TYPE C.
DATA:
W_LEN TYPE I.
* FIND LENGTH OF A STRING
W_LEN = STRLEN( P_STR ). " Space after ( and before )
WRITE:/ 'LENGTH OF', P_STR, 'IS', W_LEN." Commas
Regards
Sudheer
2007 Jul 11 6:57 AM
2007 Jul 11 6:58 AM
Hi
Just give space on both sides of the field p_str.it will work
W_LEN = STRLEN( P_STR ).
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 11 6:58 AM
hi
DATA: int TYPE i,
word1(20) TYPE c VALUE '12345',
word2(20) TYPE c ,
word3(20) TYPE c VALUE ' 4 '.
int = strlen( word1 ). WRITE int.
int = strlen( word2 ). WRITE / int.
int = strlen( word3 ). WRITE / int.
if this can be of any use..
praveen
2007 Jul 11 7:00 AM
compute W_LEN = STRLEN( P_STR ).
check the space after ( and before ).
add compute key word also.
regards
shiba dutta
2007 Jul 11 7:02 AM
PARAMETERS: p_str(30) TYPE c.
DATA : w_len TYPE i.
* FIND LENGTH OF A STRING
w_len = strlen( p_str ). " include spaces before and after p_str
WRITE:/ 'LENGTH OF', p_str , 'IS', w_len.
Regards
Gopi
2007 Jul 11 7:06 AM
hi..
parameters: P_STR(30) TYPE c.
DATA:
W_LEN TYPE I.
*STRLEN type c.
FIND LENGTH OF A STRING
W_LEN = STRLEN( P_STR )." <b>leave space between ( and P_STR.</b>
WRITE:/ 'LENGTH OF P_STR IS', W_LEN.
<b>
Reward points if useful</b>
Regards
Ashu