PMC websites shut down November 13th 2025 unless web hosting fees are paid. See up to date status from PMC Website Hosting and Domain Registration Fee Status forum topic. Please Support PMC to help keep these websites online.

Enjoyed or found this pages content useful, please Support PMC to help me keep this web page online beyond November 13th 2025 when web hosting fees are due.

User Tools

Site Tools


format

This is an old revision of the document!


Format

Composes a string containing other variables or other variable types.

Converts any variable type to a string.

If you want to convert a string back to a number, use call.

The array used with this command has to contain at least two items.

Syntax:

String = format ["FormatString", var1, var2 ...]

Parameters:
FormatString: String - a string containing references to the variables listed below in the array. The references appear in form of %1, %2 etc.
var1: Any Value - variable referenced by %1
var2: Any Value - variable referenced by %2, and so on

Return Value:
String - The full string is returned.

Example:

format ["Player side: %1 - Human players on that side: %2", side player, playersNumber side player]

The format command is very strong in combination with call. Dynamic code can be created using format and then executed with call. It is not advisable to use this command with string arguments only. Better use + for string concatenation then. If variables don't exist, their value as string is generally “scalar bool array string 0xfcffffef”.

Object array parameters work very nicely. Eg:

_MyArray = [Obj1, Obj2, Obj3];
Hint Format["MyArray=%1", _MyArray];
format.1210031684.txt.gz · Last modified: 2008/05/05 23:54 by snakeman