Simple string formatter based on the sprintf implementation.