procedure ParseForLengthDS(const AStoParse: String; Asl: TStringList);
var sInsert: String = ' ';
iSSize: Integer = 86;
iPos: Integer;
s2Parse: String;
begin
s2Parse := AStoParse;
While s2Parse <> '' do begin
If Length(s2Parse) <= iSSize then begin
Asl.Append(s2Parse);
Exit;
end;
iPos := RPosEx(' ', s2Parse, iSSize);
If iPos > Length(sInsert) then begin
Asl.Append(Copy(s2Parse, 1, iPos - 1));
s2Parse := sInsert + Copy(s2Parse, iPos + 1, MaxInt);
end
else begin
// in case space is not found, cut at specific length
Asl.Append(Copy(s2Parse,1,iSSize));
s2Parse := sInsert + Copy(s2Parse, iSSize + 1, MaxInt);
// other option: try to find space past the specific length and cut there:
//iPos := PosEx(' ', s2Parse, iSSize);
//If iPos > 0 then begin
// Asl.Append(Copy(s2Parse, 1, iPos - 1));
// s2Parse := sInsert + Copy(s2Parse, iPos + 1, MaxInt);
//end
//else begin
// Asl.Append(s2Parse);
// Exit;
//end;
end;
end;
end;