Application Development 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: 

how to use strlen

Former Member

can anyone tell me how to use strlen with an example. I tried using it but getting an error saying strlen not defined.

1 ACCEPTED SOLUTION

Former Member

Hi priyankaReddy

Note the space after begin parenthisis and before closinhg one in all the above examples.

4 REPLIES 4

former_member181962
Active Contributor
0 Kudos

data: v_len type i,

v_str type string value 'gggugik'.

v_len = strlen( v_str ).

write:/ v_len.

Regards,

ravi

Former Member
0 Kudos

Hi,

Check this example...

DATA: V_STR(4) VALUE '12'.

DATA: V_INT TYPE INT4.

V_INT = STRLEN( V_STR ).

WRITE: / V_INT.

Thanks,

Naren

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please check this sample code.


DATA: INT TYPE I,
      WORD1(20) VALUE '12345'. 
      WORD2(20).
      WORD3(20) VALUE ' 4 '. 

INT = STRLEN( WORD1 ). WRITE INT.

INT = STRLEN( WORD2 ). WRITE / INT.

INT = STRLEN( WORD3 ). WRITE / INT.

The results are 5 , 0, and 4 respectively.

Hope this will help.

Regards,

Ferry Lianto

Former Member

Hi priyankaReddy

Note the space after begin parenthisis and before closinhg one in all the above examples.