zoukankan      html  css  js  c++  java
  • 正斜杠和反斜杠

    正斜杠/,反斜杠

    正斜杠,

      作为运算符,表示除号

      在Mac和Unix上,表示路径分隔符

      在网址URL中,表示路径分隔符

      在日常文字中,表示顿号

    反斜杠,

      在Windows平台上,表示路径分隔符

    What is the difference between a backslash and a forward slash?

    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:

    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 FilesCommon Filesmicrosoft shared). On Mac and Unix systems, forward slashes are used for the same purpose (ex: /System/Library/Screen Savers).

    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.

    Backslash () vs. Forward Slash (/)

    Return to Phill Conrad's:         home page             CS8 page            CS16 page        

    Introduction

    In working with many software tools, programming languages and operating systems, it is crucial to distinguish between backslash and forward slash. Here's a way to remember which one is which.

    Imagine the cursor walking across the screen as a person.

    In English, we write from left to right. So the cursor moves across the screen from left to right as we type, like this:

     
     

    Imagine that cursor as a person, facing in the direction he/she is walking:

     
    person facing right

    Now:

    • if the person leans backward, he/she looks like a backslash
    • if the person leans forward, he/she looks like a forward slash

    backslash forward slash stick figures leaning backwards and forwards.

    Applications

    Backslash is used for:

    • file names in DOS and Windows,
      • e.g. C:Python31python.exeC:cs8cTurtle.py
    • escape sequences in C, Unix, and other languages/systems that borrow the same syntax (C++, Java, etc.)
      • for example n means newline, means tab

    Forward slash is used for:

    • File names in Unix (and Mac OS X, since it is derived from Unix), e.g.
      /cs/student/jsmith/cs8/lab00/Users/Shared/cs8/cTurtle.py
    • Web addresses (URLs) such as http://www.cs.ucsb.edu/~pconrad/cs8
    • Dividing in many progamming languages, e.g. battingAvg = hits / atBats;

  • 相关阅读:
    UG二次开发-CAM-获取修改路径参数
    多线程01
    MFC的对话框使用Scintilla
    CATIA的后处理
    win32窗体中使用Scintilla窗体
    string的reserve和resize
    前端宝典
    MarkDown学习
    JAVA中构造方法总结
    IDEA中maven和tomcat的配置
  • 原文地址:https://www.cnblogs.com/yanhc/p/10259770.html
Copyright © 2011-2022 走看看