Bueno, este código fue en honor de los 2000 mensajes de Jhonny.
Código Delphi
[-]
uses clipbrd;
function StrToStr(Str: string; S: Integer): string;
var
Bitmap: TBitmap;
i,j: integer;
begin
Result:= '';
Bitmap:= TBitmap.Create;
try
Bitmap.Canvas.Font.Name:= 'Arial Black';
Bitmap.Canvas.Font.Size:= S;
Bitmap.Width:= Bitmap.Canvas.TextWidth(Str);
Bitmap.Height:= Bitmap.Canvas.TextHeight(Str);
Bitmap.Canvas.TextOut(0,0,Str);
for j:= 0 to Bitmap.Height - 1 do
begin
for i:= 0 to Bitmap.Width - 1 do
if Bitmap.Canvas.Pixels[i,j] = $FFFFFF then
Result:= Result + ' '
else
Result:= Result + 'X';
Result:= Result + #13#10;
end;
finally
Bitmap.Free;
end;
end;
function ContarX(Str: String): Integer;
var
i: Integer;
begin
Result:= 0;
for i:= 1 to Length(Str) do
if Str[i] = 'X' then
inc(Result);
end;
function StrToStrN(Str: String; N: Integer): String;
var
i: Integer;
begin
i:= 8;
while ContarX(StrToStr(Str,i)) < N do
inc(i);
Result:= StrToStr(Str,i-1);
end;
var
Str: String;
begin
Str:= StrToStrN('Jhonny *',2000);
Clipboard.AsText:= Str;
ShowMessage(IntToStr(ContarX(Str)));
end;
Como veis, me da un texto de 1960 caracteres así que hay que añadirle las otras cuarenta X a mano