To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationThe String data type

The String data type is one of the most commonly used data types within ZPE/YASS. String data types contain character sequences stored in a single array. As such, a string can have many operations similar to a list carried out on it. A string data type in ZPE is surrounded by quotation marks.

Examples of values that the String data type could contain include "Hello"

As a reference type

As of version 1.8.12, strings are handled very differently and act as reference types. This means several things for the string. This first is that using the character index (e.g. $v[0]) and setting a value will change any references to the string. As well as this, using reference functions (also added in version 1.8.12) such as a cut on a string will change the original value of the string across the whole program.

Reference functions (ZPE 1.8.12+)

The String data type provides several reference functions that allow for ease of use:

get (number pos) ⇒ string

Returns a character from a position in a string.

append (string str) ⇒ string

Appends a string to the current string

prepend (string str) ⇒ string

Prepends a string to the current string

cut (number start, number end) ⇒ string

Returns a substring from start to end and removes it from the string.

length () ⇒ number

Returns the length of the string.


There are no comments on this page.

New comment
Comments are sent via email to me.