2006 Oct 10 5:57 AM
I have a string with both english and chinese character. Is there any method to extract only chinese character (should be dobule-byte, right?) from the string?
Thanks!
I have a string with both english and chinese character. Is there any method to extract only chinese character (should be dobule-byte, right?) from the string?
Thanks!
2006 Oct 10 11:47 AM
check this link.
http://help.sap.com/saphelp_nw2004s/helpdata/en/79/c55479b3dc11d5993800508b6b8b11/content.htm
i guess you need to use CHARLEN and findout
Raja
2006 Oct 11 5:51 AM
I have read the char one by one and find the charlen...buth both chinese and english char return charlen = 1
2007 May 22 6:47 AM
Hi,
This may be a little late but here you go anyway:
Check this out:
The path for the entire structure to get the sample code is:
Program HTWCTXM0 > Include PCTXMTWS > etc etc
Check out include PCTXMTWS
There is a Form called get_addr
Inside this Form there's a FM HR_TW_ADDRESS.
This FM gets the IT0006 address details and somewhere down the liine runs a check to see if the "Full Address" has every character in double byte.
The "TW" part of it is Taiwan, (the address data needs to be in double byte chinese, so this FM runs the check on it)
In this FM it calls a form called chk_fulltyp.
In here it loops through each character of the given string and checks if the character is a double byte:
The section of code that does this:
WHEN 2.
dft_cnt = 0.
tot_len = strlen( org_str ).
while dft_cnt < tot_len.
char = org_str+dft_cnt(1).
point = cl_abap_conv_out_ce=>uccp( char ).
if point <= last_ascii_zf.
retcode = '1'.
IF TYPE EQ 'A'.
RAISE CONTAIN_NO_FULL_TYPE.
ENDIF.
dft_cnt = tot_len. " FOR EXIT WHILE
endif.
dft_cnt = dft_cnt + 1.
endwhile.you could debug the variable "point" and see the double byte equivalent value for the current character in the string...
...and progress from there.
I do not know fully what cl_abap_conv_out_ce=>uccp does but it seems to return the double byte equivalent value. Please correct me if I am wrong on this.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |