首页 > 代码库 > 字符串转义字符
字符串转义字符
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleProgamming
{
class Program
{
static void Main(string[] args)
{
//string s = "\"ab\""; "ab"
//string s = "a\nb"; //n:newline a
//b
//string s = "a\\b"; a\b
//string s = "c:\temp\\fasdf\\dd\aa\\1.jpg"; c: emp\fasdf\dda\1.jpg
//string s = "\\\\"; \\
// string s = @"\\\\"; //字符串中的字符不当成转义符 \\\\
//string s = @"c:\temp\fasdf\dd\aa\1.jpg"; c:\temp\fasdf\dd\aa\1.jpg
// string s = @""ab""; //错误,@只对转义符有意义
Console.WriteLine(s);
//转义符只针对在代码中直接写出的字符串,对于程序中直接读出来字符串没有这个问题
Console.ReadKey();
}
}
}