zoukankan      html  css  js  c++  java
  • 去除全角半角字符

    //去除左边的全角

    function MyTrimLeft(const S: string): string;

    var

      ci, sl: integer;

      c: char;

    begin

      ci := 1; sl := length(S);

      while (ci <= sl) do

      begin

        c := S[ci];

        case c of

          ' ': inc(ci);

          #161: if (ci < sl) and (S[ci + 1] = c) then

              inc(ci, 2);

        else

          break;

        end;

      end;

      Result := Copy(S, ci, sl);

    end;

    //去除右边的全角

    function MyTrimRight(const S: string): string;

    var

      ci, sl: integer;

      c: char;

    begin

      sl := length(S);

      ci := sl;

      while (ci >= 0) do

      begin

        c := S[ci];

        case c of

          ' ': Dec(ci);

          #161: if (ci <= sl) and (S[ci - 1] = c) then

              Dec(ci, 2);

        else

          break;

        end;

      end;

      Result := Copy(S, 1, ci);

    end;

  • 相关阅读:
    mySQL安装的时候一直卡在starting server这里解决办法
    编译安装nginx
    用户访问网站原理及流程
    mysql备份及恢复
    sed
    mysql 基础
    nginx优化
    mysql 三种日志
    tr
    date
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/2035710.html
Copyright © 2011-2022 走看看