In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to get rid of the excess 00 in xstring". In daily operation, I believe many people have doubts about how to remove the excess 00 in xstring. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to remove the excess 00 in xstring"! Next, please follow the editor to study!
Today's sap systems are all unicode, so each character is represented by double bytes.
For example, the character S, the corresponding ascii code is 53, but in the sap system you see 5300 when you debug.
If we first get the xstring value of 53000A00, how can we convert it to 530A? (it is obviously inappropriate to directly replace 0)
This can be achieved through the following code:
DATA: str TYPE string VALUE 'S', xstr TYPE xstring, lt_binary TYPE TABLE OF solix. DATA: lo_conv TYPE REF TO cl_abap_conv_x2x_ce. Xstr = '53000A0000. WRITE: / 'unicode hexadecimal value:', xstr.** binary from 4103 to 4110 TRY. CALL METHOD cl_abap_conv_x2x_ce= > create EXPORTING in_encoding = '4103' "uft-16le, double byte, there is byte waste out_encoding = '4110'" uft-8, self-compressed format, East Asian word double byte, European and American single byte input = xstr RECEIVING conv = lo_conv. CATCH cx_parameter_invalid_type. CATCH cx_parameter_invalid_range. CATCH cx_sy_codepage_converter_init. ENDTRY. Lo_conv- > convert_c (). CLEAR xstr. Xstr = lo_conv- > get_out_buffer (). WRITE: / 'uft- 8hexadecimal value:', xstr.
Execution result:
Unicode hexadecimal value: 53000A00
Uft- 8hexadecimal value: 530A
Ps:string to xstring, you can use the function SCMS_STRING_TO_XSTRING.
* string to hex string. Encoding system defaults to 4110 * CALL FUNCTION 'SCMS_STRING_TO_XSTRING'* EXPORTING* text = str* encoding =' 4103 characters * IMPORTING* buffer = xstr* EXCEPTIONS* failed = 1 * OTHERS = 2. At this point, the study on "how to get rid of the excess 00 in xstring" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.