0

How to print symbol "%" in NSLog ???

NSLog(@"str %"); 

enter image description here

It gives warning

incomplete format specifier

How to resolve this problem?

Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216
Nico
  • 1,788
  • 2
  • 23
  • 41

5 Answers5

5

try this

NSLog(@"str : %%");

Thanks

Manann Sseth
  • 2,745
  • 2
  • 30
  • 50
3

Just use two percent signs:

NSLog(@"str %%"); //prints "str %"
woz
  • 10,888
  • 3
  • 34
  • 64
2

Here is the list of format specifiers for all types of data printing which can be useful for iOS programming.

iNeal
  • 1,729
  • 15
  • 23
1

You need to print like this

NSLog(@"%%");
Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
1

use this code

NSLog(@"str  %%"); 
Baby Groot
  • 4,637
  • 39
  • 52
  • 71