Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between the printf() and format() methods?

 
Santiago Bravo
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between the printf() and format() methods?

The API says that printf() is a convenience method to write a formatted string to output.

But why would you use printf() over format()?

Can anyone please elaborate?

Thanks
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But why would you use printf() over format()?


I wouldnt, since its a convenience method anyway
 
John Sutt
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what is meant here is that the printf method is available, because the function is called like that in another famous programming language (C).
So it's a convenience method for C programmers, who immediately have an idea what this method will do.
For the rest, it's exactly the same as the format() method, I believe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic