1简介
所用版本为Delphi2010,输入号码的前缀(如前7位数),随后生成0000到9999;
2实现
用到InputBox,TFileStream,IntToStr等知识点,因此我们需要uses Classes,Dialogs,SysUtils;
程序运行,弹出输入框,提示输入数字的前缀;

输入后生成数据文件,每行由前缀和后缀组成,后缀是0000到9999;
生成数据文件,文件名就是前缀.txt。
等有时间把这个功能完善一下,做成带窗口的exe。
3代码
program Project7;
uses
Dialogs,
Classes,
SysUtils;
var
i:integer;
prefix:string;
fs:TFileStream;
line:String;
bBuffer:tbytes;
const
cLineBreak=#13#10;
begin
prefix:=InputBox('提示','请输入手机号前缀','1391234');
fs:=TFileStream.Create(prefix+'.txt',fmCreate);
for i := 0 to 9999 do
begin
if i<10 then
line:=prefix+'000'+inttostr(i)+cLineBreak
else if i<100 then
line:=prefix+'00'+inttostr(i)+cLineBreak
else if i<1000 then
line:=prefix+'0'+inttostr(i)+cLineBreak
else
line:=prefix+inttostr(i)+cLineBreak;
bBuffer:=TEncoding.ASCII.GetBytes(line);
fs.WriteBuffer(bbuffer[0],Length(bBuffer));
end;
fs.Free;
end.
生成数据如下所示;







