-1

I need to transfer the double variable to the localization file, if I write %d I can only pass int, but I need to pass the double

1

1 Answer 1

0

You can pass the double with format string %f. To restrict the number of digits after the decimal point you can format is like this %0.2f. This will allow only 2 digits after the decimal point.

Sample Code:

let num = 10.5

let outputStr = String(format:"I am printing %0.1f", arguments:[num])

print(outputStr)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.