zoukankan      html  css  js  c++  java
  • BW转换例程中去掉非法字符

    * result value of the routine
       RESULT = COMM_STRUCTURE-txtmd.
      CALL FUNCTION 'Z_ZH_REMOVE_INVLID_CHARARCTER'
        CHANGING
          c_string = RESULT.
    * if abort is not equal zero, the update process will be canceled


    .....
    FUNCTION z_zh_remove_invlid_chararcter.
    *"----------------------------------------------------------------------
    *"*"Local Interface:
    *"  CHANGING
    *"     REFERENCE(C_STRING) TYPE  ANY
    *"----------------------------------------------------------------------

      DATA: l_count TYPE i,
           l_oldpos TYPE i,
           l_str(40) TYPE c,
           l_strlen TYPE i,
           l_maxcount TYPE i.

      FIELD-SYMBOLS: <fs> TYPE x.

      l_count = 0.
      l_str = c_string.
      l_strlen = STRLEN( l_str ).
      l_maxcount = l_strlen - 1.

      DO.
        IF ( l_count > l_maxcount ).
          EXIT.
        ENDIF.

        ASSIGN l_str+l_count(1) TO <fs> CASTING TYPE x.
        IF <fs> <= 127.
          l_count = l_count + 1.  "go to the next
        ELSE.                     "Chinese character
          l_count = l_count + 1.
          IF l_count > l_maxcount.
            "Wrong
            l_oldpos = l_count - 1.
            l_str+l_oldpos(1) = space.
          ELSE.
            ASSIGN l_str+l_count(1) TO <fs> CASTING TYPE x.
            IF <fs> <= 127.
              "  Wrong.
              l_oldpos = l_count - 1.
              l_str+l_oldpos(1) = space.
            ELSE.                      "Correct
              l_count = l_count + 1.   "go to the next
            ENDIF.
          ENDIF.
        ENDIF.
      ENDDO.

      c_string = l_str.
    *  BREAK-POINT.


    ENDFUNCTION.


    以下为网上的例程。

      l_strlen = STRLEN( c_text ).

      DO l_strlen TIMES.
        IF c_text+l_offset(1) < ' '.
          c_text+l_offset(1) = ' '.
        ENDIF.

        ADD 1 TO l_offset.
      ENDDO.

  • 相关阅读:
    天气预报 Web 服务
    安装IE8在控制面板里面删除之后进不去桌面,提示找不到IESetting.dll 解决办法(解决IE8卸载不了的问题,返回IE7 ,返回IE6),从IE8回到IE7的方法.
    提供股票的Web Sservices 接口
    vc中操作Xml使用CMarkup类
    不要埋怨空降兵了
    图像分割与描述
    [非常感人] 我还能再救一个!
    向汶川地震中死难者致哀
    关于dotNet加密工具
    不注册使用 .NET Reactor
  • 原文地址:https://www.cnblogs.com/Beewolf/p/1436194.html
Copyright © 2011-2022 走看看