Format alphanumeric data for presentation in C#
Use C# to format strings with white space, special characters, padding, and alignment. Give context to numeric data like currency, percentages, and numbers with decimals.
Learning objectives
- Use character escape sequences to add tabs, new lines, and Unicode characters to our strings.
- Create verbatim string literals, and escape common characters like backslash (
\) and double-quotes("). - Merge templates with variables using composite formatting and string interpolation.
- Include various format specifiers for percentages, currency, and numbers.
Prerequisites
- Introductory experience with creating and initializing variables of type
stringanddecimal - Introductory experience with literal values of type
stringanddecimal - Introductory experience with
Console.WriteLine() - Experience using Visual Studio Code to develop, build, and run C# code