Predefined function reference

format_string

A reference entry for format_string

Predefined function · string

format_string (mixed message, integer format) ⇒ string

Formats a string, message, using the standard output of the current console. If the FORCE_COLOUR setting is set to false this function will simply return the original string.

Notes

This function uses the ANSI-based command line format strings to format the input string.

The function works only on Unix-like, BSD and macOS based architectures and is not expected to work on any non-ANSI compatible terminal. It also does not function correctly when used in the GUI mode provided by the ZPE package.

Supplied formats available

The following table describes the formats available:

Code Format
0 Nothing
1 Formats text to green
2 Formats text to blue
3 Formats text to red
4 Formats text to cyan
5 Formats text to magenta
6 Formats text to yellow