Question:
How to separate number wih thousand separator?

Answer:
Here the code, its totally easy ..
The output sent to label1.Caption, you may replace to the other component.

function AddThousandSeparator(S: string; Chr: Char): string;
var
I: Integer;
begin
Result := S;
I := Length(S) - 2;
while I > 1 do
begin
Insert(Chr, Result, I);
I := I - 3;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := AddThousandSeparator('400500210', '''');
// -- 400'500'210
end;
label1.Caption := FormatFloat('#,###,###.###', 23453452);

7 Responses so far.

Post a Comment

Thank you for your comment.

Any request and idea are welcome.

CLICK TO REGISTER