Applicationmaker
asked on
Formating a String
I want to Format a String with other String variables..
Like
MyString:='The Name of the User is %s %s';
MyString:=FormatString(MyS tring,User FirstName, UserLastNa me);
ShowMessage(MyString);
I already programmed this by myself, but i want to know if there is a function or procedure which does this...
I knowed the C++ Formating procedure printf.
but i want to have it for Delphi.
Thanks for help
Like
MyString:='The Name of the User is %s %s';
MyString:=FormatString(MyS
ShowMessage(MyString);
I already programmed this by myself, but i want to know if there is a function or procedure which does this...
I knowed the C++ Formating procedure printf.
but i want to have it for Delphi.
Thanks for help
ShowMessage(Format('The Name of the User is %s %s', ['Application','Maker']));
Or, if you prefer:
procedure TForm1.Button1Click(Sender : TObject);
var
MyString, userFirstName, userLastName:String;
begin
userFirstName:='Applicatio n';
userLastName:='Maker';
MyString:=Format('The Name of the User is %s %s', [userFirstName,userLastNam e]);
ShowMessage(MyString);
end;
Regards.
procedure TForm1.Button1Click(Sender
var
MyString, userFirstName, userLastName:String;
begin
userFirstName:='Applicatio
userLastName:='Maker';
MyString:=Format('The Name of the User is %s %s', [userFirstName,userLastNam
ShowMessage(MyString);
end;
Regards.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This was what i needed!
Thanks!
Thanks!
You're welcome!