13.1. Formatting

Java programmers are familiar with the java.text and java.util packages, which have a bunch of classes that deal with formatting objects to strings. In Java, you implement formatting by specifying pattern strings. Pattern strings are string literals that have special characters that are interpreted by the runtime to format the data type. The special characters usually indicate the degree of precision, the type of formatting to be applied (based on the data type), and the positioning of the data in the formatted string. Depending on the data type being formatted (numbers, dates, or strings), formatting pattern strings differ. Pattern strings usually work in combination with locale information (java.util.Locale) and specifications ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.