P* supports defining strings inside the double quote " or single quote '.

P* allows you to interpolate variables inside a text string delimited by double quotes. A variable to be interpolated is prefixed with the dollar sign, $. The string output operators echo and errcho internally use the C++ iostream output methods cout and cerr.

In P*, you can concatenate string using the dot operator, ..

A double quote delimited string supports the following replacement escape sequences:

Table 3.2. List of double quote escape sequences

SequenceIs replaced with
\0A NULL character
\aASCII code 7, BEL (bell)
\bASCII code 8, BS (backspace)
\tASCII code 9, TAB (horizontal tab)
\nASCII code 10, LF (newline)
\vASCII code 11, VT (vertical tab)
\rASCII code 13, CR (carriage return)
\"ASCII code 34, " (double quotes)
\/ASCII code 47, / (forward slash)
\\ASCII code 92, \ (backslash)
\$ASCII code 36, $ (dollar sign)

P* will issue an error if you use a double quote escape sequence which is not defined. Single quotes only support the escape sequence \', and all other sequences with backslash are interpreted literally without any errors.

Example of string usage

SCENE main {
	int num = 2;

	echo "The number is $num\n";
	echo 'The number is $num\n';

This program will output

The number is 2
The number is $num\n