
23.03.2008, 21:06
|
 |
Местный
|
|
Регистрация: 20.02.2008
Адрес: Московская область
Сообщения: 420
Репутация: 884
|
|
Код:
Function DivText(Text:string;SymbCount:integer):string;
var
i,Len,DL,sl,el,ost:integer;
rText:string;
begin
rText:='';
Len:=Length(Text);
if Len<=SymbCount then Result:=Text else begin
dl:=Len div SymbCount;
ost:=Len mod SymbCount;
for i:=0 to dl-1 do begin
sl:=(i*SymbCount)+1;
el:=(sl+SymbCount)-1;
if rText = '' then rText:=Copy(Text,sl,SymbCount)
else rText:=rtext+#13#10+Copy(Text,sl,SymbCount);
end;
Result:=rText;
end;
end;
а можно так
Код:
Function DivText(Text:string;SymbCount:integer):string;
var
i, Len:integer;
begin
Len:=Length(Text);
Result := Copy(Text,1,SymbCount);
i := SymbCount + 1;
while i < Len do
begin
Result := Result + #13#10 + Copy(Text,i,SymbCount);
i := i + SymbCount;
end;
end;
|