LoginSignup
16
15

More than 5 years have passed since last update.

swift 数値の文字列フォーマット変換 桁数丸め

Posted at

Javaのstring.formatに似たようなのを探したらあった

swift - String formatting of a Double - Stack Overflow http://stackoverflow.com/questions/24047374/string-formatting-of-a-double

var str = NSString(format: "%.2f", 42.12312312313)

結果

42.12

16
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
15