---
name: "toString"
type: command
status: ok
groups: ["Strings", "Arrays"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/toString
revid: 351525
updated: 2023-12-06T11:24:40Z
---

# toString

*Command · Strings, Arrays · Arma 3 v0.50 · introduced in Armed Assault v1.09*

## Description

Converts the supplied [Array](../topics/Array.md) of [Number](../topics/Number.md)s into a [String](../topics/String.md) through <https://en.wikipedia.org/wiki/Unicode> characters representation conversion, or provided [Code](../topics/Code.md) to [compilable](../commands/compile.md) [String](../topics/String.md).

## Syntax

### Syntax 1

```sqf
toString array
```

**Parameters:**

- `array`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s

  > [!IMPORTANT]
  > If *array* contains non-number values, the following error might appear in .rpt file: `Bad conversion: scalar`. See [parseSimpleArray](../commands/parseSimpleArray.md) for multi-type array.

**Returns:** [String](../topics/String.md) - <https://en.wikipedia.org/wiki/Unicode> numbers converted to [String](../topics/String.md) of characters

### Syntax 2

*since arma3 2.02*

```sqf
toString code
```

**Parameters:**

- `code`: [Code](../topics/Code.md)

**Returns:** [String](../topics/String.md) - [compilable](../commands/compile.md) [String](../topics/String.md) from provided code

## Examples

### Example 1

```sqf
hint toString [65,97,338]; // returns "AaŒ"
```

### Example 2

```sqf
["test", "test"] joinString toString [12345] splitString toString [12345]; // ["test", "test"]
```

### Example 3

```sqf
private _compilableString = toString { hint "it works!" };
hint _compilableString; // hints ' hint "it works!" '
sleep 2;
call compile _compilableString; // hints ' it works! '
```

## See also

[parseSimpleArray](../commands/parseSimpleArray.md) · [set](../commands/set.md) · [resize](../commands/resize.md) · [reverse](../commands/reverse.md) · [select](../commands/select.md) · [in](../commands/in.md) · [find](../commands/find.md) · [toArray](../commands/toArray.md) · [forEach](../commands/forEach.md) · [count](../commands/count.md) · [deleteAt](../commands/deleteAt.md) · [deleteRange](../commands/deleteRange.md) · [append](../commands/append.md) · [sort](../commands/sort.md) · [param](../commands/param.md) · [params](../commands/params.md) · [arrayIntersect](../commands/arrayIntersect.md) · [splitString](../commands/splitString.md) · [joinString](../commands/joinString.md) · [toLower](../commands/toLower.md) · [toUpper](../commands/toUpper.md) · [toFixed](../commands/toFixed.md) · [endl](../commands/endl.md) · [format](../commands/format.md) · [formatText](../commands/formatText.md) · [toLowerANSI](../commands/toLowerANSI.md) · [toUpperANSI](../commands/toUpperANSI.md)

## Community notes

**DreadedEntity** — 2015-02-10

Tabs and new lines can be created with [toString](../commands/toString.md) [9] and [toString](../commands/toString.md) [10], respectively. Alternatively, a new line can also be created with [toString](../commands/toString.md) [92,110] ("\n"). If you save these strings into a variable, they can be manipulated like any other string. For example, the following code will work just fine and return the expected output:

```sqf
_tab = toString [9];
for "_i" from 0 to 3 do
{
    _tab = _tab + (toString [9]);
};
copyToClipboard format ["x%1x",tab];
```

---

**Killzone_Kid** — 2015-08-25

While you can convert any [String](../topics/String.md) to [Array](../topics/Array.md) with [toArray](../commands/toArray.md) command, only numbers from 1 to 55295 (not 65535 as expected) can be successfully converted to [String](../topics/String.md) with [toString](../commands/toString.md) and then back to [Array](../topics/Array.md) with [toArray](../commands/toArray.md) without loss of data.

<sub>Source: [BI Community Wiki — toString](https://community.bistudio.com/wiki/toString) (revision 351525).</sub>
