导航

判断字符是否为汉字

Posted on 2010-07-21 23:45  Hahappyppy  阅读(301)  评论(0编辑  收藏  举报

====================================================================
Method 1:
====================================================================
*Get Unicode of Charactor
      call method cl_abap_conv_out_ce=>uccpi
        exporting
          char = v_temp
        receiving
          uccp = v_uccp.
      if v_uccp between 0 and 128.
        v_strlen = v_strlen + 1.
      else.
        v_strlen = v_strlen + 2.
      endif.
====================================================================
Method 2:
====================================================================
DATA: alpha_num(120) TYPE c.
alpha_num = ' abcdefghijklopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,./;''[]\-=`<>?:"{}|_+~!@#$%^&*()'.
data len type i.
data n type i.
len = strlen( input ).
do len times.
  n = sy-index - 1.
  if not alpha_num cs input+n(1).
    concatenate output input+n(1) into output.
  endif.
enddo.