cancel
Showing results for 
Search instead for 
Did you mean: 

any way to know length of string with out built-in methods

nandishm
Participant
0 Kudos

Is there any way to know length of string with out using any pre defined string function.

Ex- ' hello good morning '

i want know length of this string without using built-in methods.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

data:p_string.  "Your string

data :w_num(10) value '0123456789',

        w_len type i.

w_len = strlen (p_string).

Thanks

Sam

nandishm
Participant
0 Kudos

Hello Sam

I need solution with out string functions like ( strlen ).

Former Member
0 Kudos

Hello,

Any specific cause,bcoz ultimately gole is achieved by STRLEN.if u explain the requirement may help you.

Thanks

Sam

nandishm
Participant
0 Kudos

Sam

Not any specific cause, its asked in one of the interview . I just want to know

Former Member
0 Kudos

Hello,

Please find below if helpful.

Class Name:  CL_SWF_EXP_WFSYST_STRING

Method: LENGTH

***********************FM*****************************

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       =

Thanks

Sam