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;

  • 相关阅读:
    41.分词器简单介绍
    40.倒排索引核心原理
    39.exact value and full text
    38.mapping小例子
    37.query string、_all metadata
    36.分页及deep paging
    35.multi-index和multi-type搜索模式
    BZOJ 1680 [Usaco2005 Mar]Yogurt factory:贪心【只用考虑上一个】
    BZOJ 1637 [Usaco2007 Mar]Balanced Lineup:前缀和 + 差分
    BZOJ 1647 [Usaco2007 Open]Fliptile 翻格子游戏:部分枚举 位运算
  • 原文地址:https://www.cnblogs.com/yanhc/p/10259770.html
Copyright © 2011-2022 走看看