function ZsLadder(mText: string; mLength: Integer = 0): string; { 阶梯 }
var
I, L: Integer;
S, T: string;
begin
Result := '';
L := Length(mText);
if L < 1 then Exit;
if mLength <= 0 then mLength := L;
S := '';
for I := 1 to mLength do S := S + mText[1]; //00000
T := '';
for I := 1 to mLength do T := T + mText[L]; //44444 while S <> T do begin
Result := Result + S + #13#10;
for I := mLength downto 1 do
if S[I] = mText[L] then
S[I] := mText[1]
else begin
S[I] := mText[Pos(S[I], mText) + 1];
Break;
end;
end; Result := Result + S + #13#10;
end; { ZsLadder }procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
with TStringList.Create do try
Text := ZsLadder('abcdefghijklmnopqrstuvwxyz', 2);
Text := Text + ZsLadder('abcdefghijklmnopqrstuvwxyz', 3); for I := Count - 1 downto IndexOf('xbn') + 1 do Delete(I);
for I := IndexOf('kq') - 1 downto 0 do Delete(I);
RichEdit1.Text := Text;
finally
Free;
end;
end;
var
I, L: Integer;
S, T: string;
begin
Result := '';
L := Length(mText);
if L < 1 then Exit;
if mLength <= 0 then mLength := L;
S := '';
for I := 1 to mLength do S := S + mText[1]; //00000
T := '';
for I := 1 to mLength do T := T + mText[L]; //44444 while S <> T do begin
Result := Result + S + #13#10;
for I := mLength downto 1 do
if S[I] = mText[L] then
S[I] := mText[1]
else begin
S[I] := mText[Pos(S[I], mText) + 1];
Break;
end;
end; Result := Result + S + #13#10;
end; { ZsLadder }procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
with TStringList.Create do try
Text := ZsLadder('abcdefghijklmnopqrstuvwxyz', 2);
Text := Text + ZsLadder('abcdefghijklmnopqrstuvwxyz', 3); for I := Count - 1 downto IndexOf('xbn') + 1 do Delete(I);
for I := IndexOf('kq') - 1 downto 0 do Delete(I);
RichEdit1.Text := Text;
finally
Free;
end;
end;
解决方案 »
- 怎样在delphi中备份access数据库
- delphi2005非常好
- 有关程序中“流程图”的设计,恳请高手请进来帮帮小弟!
- 如何的到系统中每个进程的CPU使用的使用情况
- 北京爱琴海第一次公开招聘,应届毕业生优先
- 请教如何实现当鼠标移在图片左边时显示Hint为'左'、到右边时显示Hint为'右'?
- 关于抓错
- 这是什么错误啊(关于sql的)
- 关于SERVICE的问题,我写了一个SERVICE,编译后,怎么能在机器上的服务的中能看到,启动运行呢?
- 怎样把Listbox1中的内容保存到INI文件中去,怎样把INI中的内容读出来??????
- 如何用变量当作控件来用,如val='TEdit' 本有TEdit(Sender) 但我要var(sender)的功能,也就是说..请进
- 怎样用SQL语句断开数据库的连接?
begin
with TStringList.Create do try
Text := Text + ZsLadder('abcdefghijklmnopqrstuvwxyz', 1);
Text := Text + ZsLadder('abcdefghijklmnopqrstuvwxyz', 2);
Text := Text + ZsLadder('abcdefghijklmnopqrstuvwxyz', 3);
SaveToFile('C:\Temp.txt');
finally
Free;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
var
I, B, E: Integer;
begin
with TStringList.Create do try
LoadFromFile('C:\Temp.txt');
B := IndexOf(Edit1.Text);
E := IndexOf(Edit2.Text);
for I := Count - 1 downto 0 do if (I > E) or (I < B) then Delete(I);
RichEdit1.Text := Text;
finally
Free;
end;
end;
但是你要考虑可行性问题'a' -> 'zzzzzz' //26^6//308915776308915776你要显示在什么地方