'

From Free Pascal wiki
Jump to navigationJump to search

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)