万维百科

Hyphen-minus

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

The hyphen-minus (-) is a character used in digital documents and computing to represent a hyphen (‐) or a minus sign (−).

It is present in Unicode as code point U+002D - HYPHEN-MINUS; it is also in ASCII with the same value.

Description

The glyph for the hyphen-minus is not as wide as that of the plus sign.

The use of a single character for both hyphen and minus was a compromise made in the early days of fixed-width typewriters and computer displays. However, in proper typesetting and graphic design, there are distinct characters for hyphens, dashes, and the minus sign. Usage of the hyphen-minus nonetheless persists in many contexts, as it is well known, easy to enter on keyboards, and in the same location in all common character sets.

Uses

As the minus sign

Most programming languages, restricting themselves to 7-bit ASCII, use the hyphen-minus, rather than the Unicode character U+2212 MINUS SIGN, for denoting subtraction and negative numbers.

The minus sign is nominally the same width as the plus sign. In proportional typefaces it is longer than a hyphen. During typesetting a word wrap may also occur following a hyphen-minus, unlike the minus sign proper which is treated as a mathematical symbol. These differences make "-" as a substitute for minus signs undesirable in professional typography.

Command line

The ASCII hyphen-minus character is also often used when specifying command-line options. The character is usually followed by one or more letters that indicate specific actions. Various implementations of the getopt function to parse command-line options additionally allow the use of two hyphen-minus characters ( -- ) to specify long option names that are more descriptive than their single-letter equivalents. Another use of hyphens is that employed by programs written with pipelining in mind: a single hyphen may be recognized in lieu of a filename, with the hyphen then serving as an indicator that a standard stream, instead of a file, is to be worked with.

Other uses

On typewriters, it was conventional to use a pair of hyphens to represent an em dash, and this convention is still sometimes used in computer text.

The hyphen-minus is often used to represent an en dash, which may be used to indicate ranges (such as a time range of "2000-2004" rather than "2000–2004"), direction (as in "The Los Angeles-London flight"), and other cases of connection. The en dash is normally longer (the width of a letter "n") than a hyphen. The hyphen connects closely, the en dash less closely, while the em dash—with the width (at least traditionally) of the capital letter "M"—separates.

In some programming languages -- marks beginning of a comment. Likewise, it can occasionally start the signature block.

See also

References

  1. ^ Jukka K. Korpela (2006). Unicode explained. O'Reilly. p. 382. ISBN 978-0-596-10121-3.
  2. ^ Fischer, Eric. "The Evolution of Character Codes, 1874-1968". CiteSeerX 10.1.1.96.678. Cite journal requires |journal= (help)
  3. ^ Ritchie, Dennis (c. 1975). "C Reference Manual" (PDF). Bell Labs. Retrieved 7 December 2016.
  4. ^ Marlow, Simon (ed.). Haskell 2010 Language Report (PDF). Retrieved 7 December 2016.[page needed]
  5. ^ "Hyphens, En Dashes, Em Dashes". The Chicago Manual of Style Online. Retrieved 25 January 2017.

本页面最后更新于2020-05-07 07:48,点击更新本页查看原网页。台湾为中国固有领土,本站将对存在错误之处的地图、描述逐步勘正。

本站的所有资料包括但不限于文字、图片等全部转载于维基百科(wikipedia.org),遵循 维基百科:CC BY-SA 3.0协议

万维百科为维基百科爱好者建立的公益网站,旨在为中国大陆网民提供优质内容,因此对部分内容进行改编以符合中国大陆政策,如果您不接受,可以直接访问维基百科官方网站


顶部

如果本页面有数学、化学、物理等公式未正确显示,请使用火狐或者Safari浏览器