• 处理中英文的函数


    function Fuzhi135(s: string): string;
    var
      cCount,eCount,eCountNum,i,isum: Integer;
    begin
      cCount := 0;
      eCount := 0;
      eCountNum := 0;
      for i := 1 to length(s) do
      begin
        if ByteType(s, i) = mbSingleByte then
          inc(cCount)
        else if ByteType(s, i) = mbLeadByte then
        begin
          Inc(eCount);
          eCountNum := eCountNum + 2;
        end;
        isum := cCount+ eCount;
        if isum=135 then
          Break;
      end;
      Result := Copy(s,1,cCount+eCountNum);
    end;

    function Fuzhi5(s: string): string;
    var
      cCount,eCount,eCountNum,i,isum: Integer;
    begin
      cCount := 0;
      eCount := 0;
      eCountNum := 0;
      for i := 1 to length(s) do
      begin
        if ByteType(s, i) = mbSingleByte then
          inc(cCount)
        else if ByteType(s, i) = mbLeadByte then
        begin
          Inc(eCount);
          eCountNum := eCountNum + 2;
        end;
        isum := cCount+ eCount;
        if isum=135 then
          Break;
      end;
      Result := Copy(s,cCount+eCountNum+1,10);
    end;

    function TotalStrSum(s: string): Integer;
    var
      cCount,eCount,i: Integer;
    begin
      cCount := 0;
      eCount := 0;
      for i := 1 to length(s) do
      begin
        if ByteType(s, i) = mbSingleByte then
          inc(cCount)
        else if ByteType(s, i) = mbLeadByte then
          inc(eCount);
      end;
      Result := eCount+cCount;
    end;

  • 相关阅读:
    vue 中动画配置
    vue hash模式和404页面的配置
    vue 组件用法
    vue set方法
    vue 改变插值方法
    vue 接口统一管理
    Oracle同义词(Synonym)创建删除
    ASP.NET Core中间件实现分布式 Session
    plsql 导入导出表数据与表结构
    css3缩放 transform: scale() 使用缩放之后顶点对齐问题
  • 原文地址:https://www.cnblogs.com/batman425/p/3242756.html
Copyright © 2020-2023  润新知