Application Development and Automation 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: 
Read only

class to calculate string length

Former Member
0 Likes
1,450

Hi All,

is there any class having a method to calculate the string length.

Thanks

Hi All,

is there any class having a method to calculate the string length.

Thanks

8 REPLIES 8
Read only

Sm1tje
Active Contributor
0 Likes
1,205

does it have to be a class? There is a keyword NUMOFCHARS or STRLEN to determine this.

Read only

Former Member
0 Likes
1,205

Hi Ravi,

you can use the STRLEN. i don't think we need the class for that.

you will get direcly the no. of charectes in the string.

try below.

data: lv_string type string.
data: lv_char type i.

lv_char = STRLEN(lv_sti).

hope it helps you.

Regards!

Read only

0 Likes
1,205

Hi,

i know that we can use strlen to cslculate the string length

but i need some fm or class method to calculate the str length...

Thanks

Ravi Aswani

Read only

0 Likes
1,205

Hi,

Please Check the following FMs.

STRING_LENGTH

SWA_STRINGLENGTH_GET

Hope will solve out,

Kind Regards,

Faisal

Read only

0 Likes
1,205

Hi Ravi,

You can use the FM SWA_STRINGLENGTH_GET

data: lv_length type SWAEXPDEF-ELEMLENGTH,
                 lv_string type string.

      CALL FUNCTION 'SWA_STRINGLENGTH_GET'
        EXPORTING
          expression                 =   lv_string
*         CONDENSE_NO_GAPS           =
*         CONDENSE                   =
*         WITH_LEADING_BLANKS        =
*       IMPORTING
         LENGTH                     = lv_length
*         EX_MODIFY_EXPRESSION       =
                .

hope it helps you

Regards!

Read only

0 Likes
1,205

Thanks for the reply...

but i don't want to use obselete fm or fm that has not been released...

thanks

Read only

Former Member
0 Likes
1,205

Class Name: CL_SWF_EXP_WFSYST_STRING

Method: LENGTH

Read only

Former Member
0 Likes
1,205

Helpful answer

thank u