//把一个字符串按指定的每行字符个数分割成多行
Function DivideStrToLine(In_Str:String;In_StrPerLine:Integer):String;
var
iLine,iIndex,iLength:Integer;
Begin
Result := '';
iLength := Length(In_Str);
iIndex := 1;
iLine := 1;
while (iIndex <= iLength) do
Begin
if (ByteType(In_Str,iIndex) = mbSingleByte) then
Begin
Result := Result + Copy(In_Str,iIndex,1);
Inc(iIndex);
End
Else
if (ByteType(In_Str,iIndex) = mbLeadByte) then
Begin
Result := Result + Copy(In_Str,iIndex,2);
iIndex := iIndex + 2;
End;
if ((iIndex < iLength) and (iIndex >= iLine * In_StrPerLine)) then
Begin
Result := Result + #13;
Inc(iLine) ;
End;
End;
End;
用法:
procedure TForm1.btn1Click(Sender: TObject);
begin
Series1.Add(21,DivideStrToLine('AAAAAAAAAAAAAAAAAAAAA',5));
end;