正斜杠和反斜杠区别

时间:2022-05-22 04:06:19

Answer: The term “backslash” is on of the most incorrectly used terms in computing. People often refer to forward slashes as backslashes, especially when referring to URLs. Web addresses (URLs), such as http://pc.net/helpcenter/, contain forward slashes, rather than backslashes. The difference between a backslash and a forward slash is defined below:

翻译:backslash 也就是反斜杠“\”,在url中,一般使用正斜杠“/”,例如http://pc.net/helpcenter/,具体两者的差别在那:

Backslash: \ 反斜杠

Forward Slash: / 正斜杠

A good way to remember the difference between a backslash and a forward slash is that a backslash leans backwards ( \ ), while a forward slash leans forward ( / ).

翻译:记住两者区别的最好的是,后斜杠是“撇”(捺),正斜杠是“撇丿”

In Windows, backslashes are used to separate directories in file paths (ex: C:\Program Files\Common Files\microsoft shared). On Mac and Unix systems, forward slashes are used for the same purpose (ex: /System/Library/Screen Savers).

翻译:在windows系统中,反斜杠尝尝用于表示文件路径;在unix系统和mac中,正斜杠用于url和文件路径表示。

Forward slashes can also be called simply “slashes,” since they are much more commonly used than backslashes. (Slashes are also used as division symbols and in place of the word “or.”) Therefore, the URL http://pc.net/helpcenter/ could be verbalized, “PC dot net slash help center.” If you say “backslash” when sharing a URL, people will know what you mean, but you might come across as a noob. Therefore, it’s best to get in the habit of using the correct term.

翻译:正斜杠、反斜杠也常常称作“斜杠”,必须正确使用它们。


在现在C#或者web层,经常会用到转义字符,我们就使用反斜杠“\”来进行转义区别。

  1.   \’    单引号
  2. \”    双引号
  3.   \    反斜杠
  4.   \0    空
  5.   \a    警告
  6.   \b    退格
  7.   \f    换页
  8.   \n 换行
  9.   \r    回车
  10. \t    水平制表符
  11.   \v 垂直制表符