zoukankan      html  css  js  c++  java
  • 处理中英文的函数

    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;

  • 相关阅读:
    BlogEngine.Net
    加速Web开发的9款知名HTML5框架
    个人论坛博客的代码
    Android客户端调用Asp.net的WebService
    前端总结数据结构与算法基础
    node知识点及第三方模块
    消息轮播
    el-date-picker 组件时间格式化方式
    Vue+Element前端导入导出Excel
    vue单元测试
  • 原文地址:https://www.cnblogs.com/batman425/p/3242756.html
Copyright © 2011-2022 走看看