': what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: '
| Old | New | Line | |
|---|---|---|---|
| 1 | + | The typewriter’s single quote `'` is used in [[Pascal]] to delimit [[Character and string types|string and character literals]]. | |
| 2 | + | ||
| 3 | + | ``` pascal | |
| 4 | + | program helloWorld(input, output, stdErr); | |
| 5 | + | resourcestring | |
| 6 | + | greeting = 'Hello world!'; | |
| 7 | + | begin | |
| 8 | + | writeLn(greeting); | |
| 9 | + | end. | |
| 10 | + | ``` | |
| 11 | + | ||
| 12 | + | In order to insert a `'` into a character or string literal, two `'` are written back-to-back: | |
| 13 | + | ||
| 14 | + | ``` pascal | |
| 15 | + | program singleQuoteDemo(input, output, stdErr); | |
| 16 | + | begin | |
| 17 | + | writeLn('writeLn(''…'');'); | |
| 18 | + | end. | |
| 19 | + | ``` | |
| 20 | + | ||
| 21 | + | One may inject numeric character entities into a string, by placing them directly adjacent to one another: | |
| 22 | + | ||
| 23 | + | ``` pascal | |
| 24 | + | program bellDemo(input, output, stdErr); | |
| 25 | + | begin | |
| 26 | + | writeLn('🕭'#7); | |
| 27 | + | end. | |
| 28 | + | ``` | |
| 29 | + | ||
| 30 | + | ## other remarks | |
| 31 | + | ||
| 32 | + | The only forbidden character in a string or character literal is a [[Carriage return|carriage return]]. See [bug \#35827](https://bugs.freepascal.org/view.php?id=35827) for a (as of 2019‑08‑24) proposed feature. | |
| 33 | + | ||
| 34 | + | In [[GNU Pascal|GPC]] `"` are used as string delimiters, too. Such strings can contain backslash-escaped control characters. | |
| 35 | + | ||
| 36 | + | In [[ASCII]] the character `'` has the ordinal value `39` (or [[Hexadecimal|hexadecimal]] `27`). | |
| 37 | + | ||
| 38 | + | The `’` (`U+2019` “right single quotation mark”) is the typographically correct character marking the possessive case in English (e. g. “the dog’s ball”). | |
| 39 | + | ||
| 40 | + | ## see also | |
| 41 | + | ||
| 42 | + | - [§ “character strings” in the *Free Pascal reference guide*](https://www.freepascal.org/docs-html/ref/refse8.html) | |
| 43 | + | ||
| 44 | + | --- | |
| 45 | + | *From the Free Pascal wiki, page "'", as it stood on 2022-08-06 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
