这样的数字处理怎么写一个LISTBOX1的内容是00001到99999所有5位的数字,所有数字都是五位,比如
00001
00003
00004
00007
00008
00009
00010
00012
等等....按button1后快速找出listbox1中不存在的数字,然后显示在listbox2里,比如
00002
00005
00006
00011
00013
等等....
00001
00003
00004
00007
00008
00009
00010
00012
等等....按button1后快速找出listbox1中不存在的数字,然后显示在listbox2里,比如
00002
00005
00006
00011
00013
等等....
解决方案 »
- 问下数据库购买的问题,着急,是SQL SERVER
- 编辑DBGridEh某列的时候,如何捕获键盘输入
- 简历上的项目经验该怎么下
- 如何判断一个 OLE字段没有内容?
- 如何使webbrowser控件的滚动条自动下拉到指定位置或下拉到底部?急
- 编程思路
- 一般情况在做完一个程序,打包之前都需要检查、注意什么呢?
- 急!!!一个linux下安装jdk,tomcat的问题。安装完成后,能用java 测试,但是。。。。。。。
- 请问如何在 fastreport 中画出斜线?
- 程序员的骄傲!!!
- fastreport一个实现效果问题,往高手进来解决,谢谢!
- 求:SQL2008下備份或還原數據庫的代碼或存儲過程???
咋n多帖子都是结帖率低下的id在问问题呢?
var
iLoop : Integer;
sValue : String;
begin
for iLoop := 1 to 99999 do
begin
sValue := Format('%.5d', [iLoop]);
if ListBox1.Items.IndexOf(sValue) < 0 then ListBox2.Items.Add(svalue);
end;
end;
var
i:integer;
str:string;
begin
for i := 1 to 10000 do //范围自己定
begin
str := Format('%.5d',[i]);//前补0,总长度5
if ListBox1.Items.IndexOf(str) < 0 then
ListBox2.Items.Add(str)
end;
end;
intI: Integer;
strList: TStringList;
strList2: TStringList;
strList3: TStringList;
begin
strList2:= TStringList.Create;
//--测试数据
strList:= TStringList.Create;
for intI:= 1 to 99 do
begin
strList.Add(format('%0.5d',[intI]));
end; for intI:= 103 to 999 do
begin
strList.Add(format('%0.5d',[intI]));
end;
//--测试数据
strList3:= TStringList.Create;
strList3.Assign(strList);
for intI:= 1 to 99999 do
begin
if (strList3.Count<intI) or (strList3.Strings[intI-1]<>format('%0.5d',[intI])) then
begin
strList2.Add(format('%0.5d',[intI]));
strList3.Insert(intI-1,format('%0.5d',[intI]));
end;
end; listbox1.Items.Assign(strList2); strList3.Free;
strList.Free;
strList2.Free;
end;
begin
//首先把1等数字转换为00001的格式
s := formatFloat('00000',BaseNumber);
if ListBox1.Items.IndexOf(s)=-1 then addToListBox2;
end;