0 votes

I want to show a % sign inside a string... is there a way?

$AccuracyLabel.text = "Accuracy: %s" % (int(round((float(PlayerData.shots_hit) / PlayerData.shots_fired) * 100)))

prints and integer (as expected) so

Accuracy: 87

how do I get it to be Accuracy: 87% ?
I tried your example with escaping for quotes within quotes with \ but \% didnt help...

Godot version 3.2.3 stable
in Engine by (362 points)

1 Answer

+1 vote
Best answer

Double the percent sign: ("Accuracy: %s%%")

by (152 points)
selected by

thx! =) couldnt find that answer anywhere...

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.