Exercise – Combine strings using character escape sequences
Suppose you’ve been asked to create a mockup of a command-line tool that will generate invoices in both English and Japanese. You don’t have to build the actual functionality that generates the invoices yet. You only need to provide the command line interface to internal customers in the billing department for their approval. Your manager asked you to make sure you add formatting to make the current progress of the tool clear. Your manager also asked you to provide instructions for the Japanese users on how to generate invoices in Japanese.
Exercise – Format literal strings in C#
In this exercise, you’ll learn different techniques to display special characters and add different types of formatting to the output.
Character escape sequences
An escape character sequence is an instruction to the runtime to insert a special character that will affect the output of your string. In C#, the escape character sequence begins with a backslash \
followed by the character you’re escaping. For example, the \n
sequence will add a new line, and a \t
sequence will add a tab.