Re-added NSStringFormatting.

Hopefully, this implementation will be better than the one removed in
6d382104dc33.
Code formatting improvements.

No functional changes.