20.12.2014, 11:59
|
|
LMD-DML
|
|
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
|
|
Для данной конкретной строки получился вот такой бред - компиляция из всего вышеприведённого кода
Код:
procedure TForm1.Button1Click(Sender: TObject);
function wr(c1,c2: char): string;
var
c: char;
begin
Result:='';
for c := 'A' to 'Z' do
begin
if c = c1 then Result:= c1 else
if Length(Result) > 0 then Result:= Result + c;
if c = c2 then exit;
end;
end;
var
c: char;
s: string;
sl: TStrings;
i,j,i1,i2,i3: integer;
begin
s:= Edit1.Text; // '[A-C][EF][K-PSZ]';
s:= StringReplace(s,'[','',[rfReplaceAll]);
s:= StringReplace(s,']',#13#10,[rfReplaceAll]);
sl:= TStringList.Create;
sl.Text:= s;
for i := 0 to sl.Count -1 do
if Pos('-', sl[i]) > 0 then
begin
s:= '';
j:= 1;
while j < Length(sl[i]) do
begin
s:=s+sl[i][j];
if (j+1 < Length(sl[i])) and (sl[i][j+1] = '-') then
begin
Delete(s,Length(s),1);
s:= s + wr(sl[i][j], sl[i][j+2]);
inc(j,2);
end;
inc(j);
end;
s:=s+sl[i][j];
sl[i]:=s;
end;
Memo1.Clear;
for i1:= 1 to Length(sl[0]) do
for i2:= 1 to Length(sl[1]) do
for i3:= 1 to Length(sl[2]) do
Memo1.Lines.Add(sl[0][i1] + sl[1][i2] + sl[2][i3]);
sl.Free;
end;
<DELETED>
|