String

A String is any sequence of characters enclosed by quotes. PTPScript does not support Unicode and so all characters are ASCII-based, meaning there are 256 different possibilities.

There is no practical limit to the size of Strings that PTPScript can support.

A String can be declared in various different ways:

Each type of String can contain all symbols except its own delimiters, and of course the PTPScript placeholder symbols - { and }. If a String should contain a delimiter, it will need to be escaped with the backslash character - \. If the backslash needs to appear before a delimiter, or at the end of the String, it should be doubled. Using triple quotes is useful when a String needs to contain various quote marks and you don't want to bother with escaping them. No "special" characters are recognised in any of the String formats, other than the escape character itself. If a String contains a placeholder, this placeholder will be evaluated before the String (see nested placeholders).

For example:

{ a = "hello" }
{ a = "123" }
{ a = "I'm still valid" }
 
{ b = 'Another string' }
{ b = 'John said, "hi!"' }
{ b = 'It\'s good to escape, once in a while' }
 
{ c = """Getting the hang of this? "Easy!" - 'Yup'""" }
 
{ d = '''Even triple-quotes can be escaped - look: \''' ...see?'''}

Converting to String

To explicitly convert a value to String, the String typecast operator - ~ - should be used. Some operators, such as the concatenation operator - ~ - also explictly convert a value to String. (Yes, they are the same symbol, but the former is a prefix operator, and the latter is an infix operator. See Operators for more information.)

When converting to String: