Escape sequence

Escape sequence

Escape sequence is to express the special character and function which cannot be expressed in the usual character by a special character sequence.

Normally, programming languages specify escape sequences, and special characters and functions can be embedded in strings.

In C#:


string tab = "\t";


This is a string which express the tab. The \ is a special character for escape sequence.

There is no escape sequence in the Rice.

Rice has no escape sequences. Therefore, double quotes cannot be used directly within the string because they are used to represent the string itself. In addition, characters that cannot be explicitly displayed, such as line breaks and tabs, cannot be used.

If these special characters are needed, you should use the replacement or concatenation.

When the tab is needed in the string:


string tab = "@This is a string.".Replace("@", "".TAB);


@ is replaced with the tab.

You can use the named comment to create string containing special characters without any restrictions.

Copyright © Rice All rights reserved.