Difference between revisions of "'"

From Free Pascal wiki
Jump to navigationJump to search
(complete rewrite)
 
Line 1: Line 1:
 
{{'}}
 
{{'}}
  
The typewriter’s single quote <syntaxhighlight lang="pascal" enclose="none">'</syntaxhighlight> is used in [[Pascal]] to delimit [[Character and string types|string and character literals]].
+
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">
 
<syntaxhighlight lang="pascal" highlight="3">
Line 12: Line 12:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
In order to insert a <syntaxhighlight lang="pascal" enclose="none">'</syntaxhighlight> into a character or string literal, two <syntaxhighlight lang="pascal" enclose="none">'</syntaxhighlight> are written back-to-back:
+
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">
 
<syntaxhighlight lang="pascal" highlight="3">
 
program singleQuoteDemo(input, output, stdErr);
 
program singleQuoteDemo(input, output, stdErr);
Line 32: Line 32:
 
See [https://bugs.freepascal.org/view.php?id=35827 bug #35827] for a (as of 2019‑08‑24) proposed feature.
 
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" enclose="none">"</syntaxhighlight> are used as string delimiters, too.
+
In [[GNU Pascal|GPC]] <syntaxhighlight lang="pascal" inline>"</syntaxhighlight> are used as string delimiters, too.
 
Such strings can contain backslash-escaped control characters.
 
Such strings can contain backslash-escaped control characters.
  
In [[ASCII]] the character <syntaxhighlight lang="pascal" enclose="none">'</syntaxhighlight> has the ordinal value <syntaxhighlight lang="pascal" enclose="none">39</syntaxhighlight> (or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" enclose="none">27</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" enclose="none">’</syntaxhighlight> (<syntaxhighlight lang="text" enclose="none">U+2019</syntaxhighlight> “right single quotation mark”) is the typographically correct character marking the possessive case in English (e. g. “the dog’s ball”).
+
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 ==
 
== see also ==

Latest revision as of 17: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


navigation bar: topic: Pascal symbols
single characters

+ (plus)  •  - (minus)  •  * (asterisk)  •  / (slash)
= (equal)  •  > (greater than)  •  < (less than)
. (period)  •  : (colon)  •  ; (semi colon)
^ (hat)  •  @ (at)
$ (dollar sign)  •  & (ampersand)  •  # (hash)
' (single quote)

character pairs

<> (not equal)  •  <= (less than or equal)  •  := (becomes)  •  >= (greater than or equal)

 •  >< (symmetric difference)  •  // (double slash)