String format specifiers in Objective-C

To include a variable in a string in objective-c, you can use string format specifiers with optional length modifiers.

  • %i  - Integer
  • %c - character
  • %d - Signed decimal Integer
  • %e - Scientific notation using e character
  • %E - Scientific notation using E character
  • %f - floating point decimal
  • %g - the shortest of either %e or %f
  • %G - the shorter of %E or %f
  • %s - string
  • %u - unsigned decimal

Full list: String Format Specifiers - Apple