本文主要是介绍获取打印页号列表,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
获取打印页号列表
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;
posted on
2011-06-28 11:18
万一
阅读(1589)
评论(1)
编辑
收藏
这篇关于获取打印页号列表的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!