C++ Equivalent of %ld in Java for String.format()

Milli picture Milli · Jan 6, 2010 · Viewed 57.3k times · Source

For instance, %11.2lf in C++ becomes %11.2f in Java. How about for long format?

Answer

Andrzej Doyle picture Andrzej Doyle · Jan 6, 2010

As you may have worked out, it's not necessary to specify the l flag. According to the docs, a decimal integer is specified by d just like in C++. So the answer is just %d.