argoneus
argoneus

Reputation: 1147

How to print a string in a Label's caption?

I have a form with a label, in which I want to put the variable 'accuracy' of type Real along with the symbol '%' (e.g. in format 57,49%). Is that even possible with a Label? I tried googling but didn't find anything relevant. Thanks a lot.

Upvotes: 1

Views: 1806

Answers (1)

J...
J...

Reputation: 31443

Label1.Caption := Format('%.2f%%', [accuracy]); 

The second % escapes the percent symbol and treats it as a part of the actual string (and not a format string).

Upvotes: 8

Related Questions