---
name: "str"
type: command
status: ok
groups: ["Strings"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/str
revid: 347635
updated: 2023-10-03T08:38:22Z
---

# str

*Command · Strings · Arma 3 v0.50 · introduced in Armed Assault v1.00*

## Description

Converts any value into a string, depending on its type. If an [Object](../topics/Object.md) has a [vehicleVarName](../commands/vehicleVarName.md), it is returned (see [#Example 4](../commands/str.md#example-4)).

## Syntax

```sqf
str value
```

**Parameters:**

- `value`: [Anything](../topics/Anything.md)

**Returns:** [String](../topics/String.md) - if *value* is a [String](../topics/String.md), double quotes `""` will surround it (see [#Example 3](../commands/str.md#example-3))

## Examples

### Example 1

```sqf
_s = str (5 + 2); // The value of _s is the string "7"
```

### Example 2

```sqf
a = [];
ac = 0;
while { ac < 5 } do
{
    ac = count a;
    a set [ac, format ["Index %1", ac]];
};
hintSilent str a; // hints all of ["Index 0","Index 1","Index 2","Index 3","Index 4"] including brackets, quotes and commas
```

### Example 3

```sqf
str [0, 0, 0] == "[0, 0, 0]";    // false
str [0, 0, 0] == "[0,0,0]";        // true

str "a";            // """a"""
count str "a";        // 3
str text "a";        // "a"
count str text "a";    // 1
```

### Example 4

```sqf
str objNull;        // "<NULL-object>"
str player;            // e.g "B Alpha 1-1:1 (PlayerName)"
player setVehicleVarName "PlayerUnit";
str player;            // "PlayerUnit"
```

## Problems

Before Arma 3 v1.64 this command did not escape a [String](../topics/String.md)'s double quotes `""` properly.

## See also

[toArray](../commands/toArray.md) · [toString](../commands/toString.md) · [isText](../commands/isText.md) · [select](../commands/select.md) · [count](../commands/count.md) · [find](../commands/find.md) · [endl](../commands/endl.md) · [format](../commands/format.md) · [formatText](../commands/formatText.md)

## Community notes

**Sbsmac** — 2009-09-29

When applied to a unit, this returns the variable name that was assigned to the unit in the editor (see also [vehicleVarName](../commands/vehicleVarName.md)).
For example, if you have created a playable unit with the name 'thePlayer' then you can use 'str player' to return "thePlayer".

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