Hi,
I'm completely new to Delphi and I need help.
How can I split the string and add comma every three digits like that?
abc,def,ghi
I could split numbers using FormatFloat but string???
This is quite easy to do. You should code a function similar to:
Code:
function InsertCommas ( const s: string ): string;
var
p: integer;
begin
result := s;
p := Length(result) - 2;
while p > 1 do begin
Insert ( ',', result, p );
dec ( p, 3 );
end;
end;
and call it as follows (for example in response to a button click to put commas into the contents of Edit1 TEdit control):
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.