Difference between revisions of "'"
(Created page with "{{'}} <div style="float:right; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">'</div> In ...") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{'}} | {{'}} | ||
− | < | + | The typewriter’s single quote <syntaxhighlight lang="pascal" inline>'</syntaxhighlight> is used in [[Pascal]] to delimit [[Character and string types|string and character literals]]. |
− | |||
− | + | <syntaxhighlight lang="pascal" highlight="3"> | |
+ | program helloWorld(input, output, stdErr); | ||
+ | resourcestring | ||
+ | greeting = 'Hello world!'; | ||
+ | begin | ||
+ | writeLn(greeting); | ||
+ | end. | ||
+ | </syntaxhighlight> | ||
− | <syntaxhighlight> | + | In order to insert a <syntaxhighlight lang="pascal" inline>'</syntaxhighlight> into a character or string literal, two <syntaxhighlight lang="pascal" inline>'</syntaxhighlight> are written back-to-back: |
+ | <syntaxhighlight lang="pascal" highlight="3"> | ||
+ | program singleQuoteDemo(input, output, stdErr); | ||
+ | begin | ||
+ | writeLn('writeLn(''…'');'); | ||
+ | end. | ||
+ | </syntaxhighlight> | ||
− | + | One may inject numeric character entities into a string, by placing them directly adjacent to one another: | |
− | + | <syntaxhighlight lang="pascal" highlight="3"> | |
− | + | program bellDemo(input, output, stdErr); | |
begin | begin | ||
− | + | writeLn('🕭'#7); | |
− | + | end. | |
− | + | </syntaxhighlight> | |
− | end. | ||
− | + | == other remarks == | |
+ | The only forbidden character in a string or character literal is a [[Carriage return|carriage return]]. | ||
+ | See [https://bugs.freepascal.org/view.php?id=35827 bug #35827] for a (as of 2019‑08‑24) proposed feature. | ||
− | + | In [[GNU Pascal|GPC]] <syntaxhighlight lang="pascal" inline>"</syntaxhighlight> are used as string delimiters, too. | |
+ | Such strings can contain backslash-escaped control characters. | ||
− | <syntaxhighlight> | + | In [[ASCII]] the character <syntaxhighlight lang="pascal" inline>'</syntaxhighlight> has the ordinal value <syntaxhighlight lang="pascal" inline>39</syntaxhighlight> (or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" inline>27</syntaxhighlight>). |
− | + | The <syntaxhighlight lang="pascal" inline>’</syntaxhighlight> (<syntaxhighlight lang="text" inline>U+2019</syntaxhighlight> “right single quotation mark”) is the typographically correct character marking the possessive case in English (e. g. “the dog’s ball”). | |
− | + | == see also == | |
− | + | * [https://www.freepascal.org/docs-html/ref/refse8.html § “character strings” in the ''Free Pascal reference guide''] | |
− | |||
{{Symbols}} | {{Symbols}} |
Latest revision as of 16:15, 6 August 2022
│
English (en) │
suomi (fi) │
The typewriter’s single quote '
is used in Pascal to delimit string and character literals.
program helloWorld(input, output, stdErr);
resourcestring
greeting = 'Hello world!';
begin
writeLn(greeting);
end.
In order to insert a '
into a character or string literal, two '
are written back-to-back:
program singleQuoteDemo(input, output, stdErr);
begin
writeLn('writeLn(''…'');');
end.
One may inject numeric character entities into a string, by placing them directly adjacent to one another:
program bellDemo(input, output, stdErr);
begin
writeLn('🕭'#7);
end.
other remarks
The only forbidden character in a string or character literal is a carriage return. See bug #35827 for a (as of 2019‑08‑24) proposed feature.
In GPC "
are used as string delimiters, too.
Such strings can contain backslash-escaped control characters.
In ASCII the character '
has the ordinal value 39
(or hexadecimal 27
).
The ’
(U+2019
“right single quotation mark”) is the typographically correct character marking the possessive case in English (e. g. “the dog’s ball”).
see also
single characters |
|
character pairs |
|