zoukankan      html  css  js  c++  java
  • 获取打印页号列表


    procedure SplitCommaCross(aList: TStrings);
      procedure SPlitCross(aList: TStrings);
      var
        LList: TStrings;
        a,b: Integer;
        i: Integer;
      begin
        if Pos('-', aList.Text) < 2 then Exit;
        LList := TStringList.Create;
        ExtractStrings(['-'], [' '], PChar(aList.Text), LList);
        if LList.Count = 2 then
        begin
          aList.Clear;
          a := StrToIntDef(LList[0], 0);
          b := StrToIntDef(LList[1], -1);
          for i := a to b do aList.Add(IntToStr(i));
        end;
        LList.Free;
      end;
    var
      LList,RList: TStrings;
      s: string;
    begin
      aList.CommaText := Trim(aList.Text);
      LList := TStringList.Create;
      RList := TStringList.Create;
      for s in aList do
      begin
        LList.Text := Trim(s);
        SPlitCross(LList);
        RList.AddStrings(LList);
      end;
      aList.Assign(RList);
      LList.Free;
      RList.Free;
    end;
    
    //测试
    var
      str: string;
      List: TStrings;
    begin
      str := '1-3,5-6,8';
      List := TStringList.Create;
      List.Text := Trim(str);
      SplitCommaCross(List);
      ShowMessage(List.Text); //1 2 3 5 6 8
      List.Free;
    end;
    

  • 相关阅读:
    南阳779
    南阳599
    南阳484
    margin叠加相邻两个元素的上下margin是叠加在一起
    margin
    padding
    css05 字体以及行间距
    mysql相似于oracle的to_char() to_date()方法
    sqlite两表更新update
    SQL查找重复项目
  • 原文地址:https://www.cnblogs.com/del/p/2092056.html
Copyright © 2011-2022 走看看