How to add percent sign in string format? [duplicate] How to add percent sign in string format? [duplicate] ios ios

How to add percent sign in string format? [duplicate]


write two time %:

rate = 99.99let str = String(format: "%.2f%%", rate)


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

You can do this by using %% in the printf statement. For example, you can write printf(“10%%”) to have the output appear as 10% on the screen.

Hope it help you :)