
Escape Sequence = ES
ES 1 - “\b”:
This ES will delete the char from the left, for example:
static void Main(string[] args)
{
string a = "123\b4";
Console.WriteLine(a);
//Result
= 124
}
This ES will move all strings from his right to a new line, for example:
static void Main(string[] args)
{
string a = "123\n4";
Console.WriteLine(a);//Result line 1 = 123
//Result line 2 = 4
}
ES 3 - \”:
As you remember, the string variable start and closed with “”, if you want to add “” without manipulating the original string you can use this ES, for example:
static void Main(string[] args)
{
string a = "123\"4";
Console.WriteLine(a);
//Result = 123"4
}
ES 4 - \”:
Same issue as ES 3, just with ‘ :
static void Main(string[] args)
{
string a = "123\’4";
Console.WriteLine(a);
//Result = 123'4
}
static void Main(string[] args)
{
string a = "123\\4";
Console.WriteLine(a);
//Result
= 123\4
}
ES 6 - \t:
This ES will add ‘Tab’
for string
{
string a = "123\t4";
Console.WriteLine(a);
//Result
= 123 4
}
ES 7 - \r:
This ES will delete all
strings located on his left side
{
string a = "123\r4";
Console.WriteLine(a);
//Result
= Beep Sound
}
ES 8 - \a:
I added this ES just for
fun, if you use it you find your computer singing Beep…Beep….
static void Main(string[] args)
{
string a = "123\a4";
Console.WriteLine(a);
//Result
= Beep Sound
}
Nice post!
ReplyDeleteIn the case of \r, I'd also mention the combination of \r\n, which has a different meaning: carriage return + line feed, Windows style for line breaks.