Calculate the length of a string

Source: Internet
Author: User
1. The static method of the cl_abap_list_utilities => dynamic_output_length class can calculate the string length. The output below is 7
Data: lv_str type string, lv_len type I, lv_char type C. lv_str = 'abc China '. * lv_char = lv_str + 3 (0 ). lv_len = cl_abap_list_utilities => dynamic_output_length (lv_str ). * lv_len = strlen (lv_str ). * lv_len = cl_abap_list_utilities => defined_output_length (lv_str ). write lv_len.

2. The strlen function only obtains the number of characters in the string and cannot obtain the string length. The output below is 5.

Data: lv_str type string, lv_len type I, lv_char type C. lv_str = 'abc China '. * lv_char = lv_str + 3 (0 ). * lv_len = cl_abap_list_utilities => dynamic_output_length (lv_str ). lv_len = strlen (lv_str ). * lv_len = cl_abap_list_utilities => defined_output_length (lv_str ). write lv_len.

There are many other static methods in the class cl_abap_list_utilities, which are worth studying.

Calculate the length of a string

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.