0
1

More than 5 years have passed since last update.

floatのformatで0埋めする

Last updated at Posted at 2014-02-03

000.0としたかったら以下。

NSString* string = [NSString stringWithFormat:@"%05.1f", 0.0];
NSLog(@"string is %@", string);//=> string is 000.0

最初の05のところで全体の長さを決めているらしいです。
この場合は.も含めて5文字で治まるようにformatされました。

0
1
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
0
1