---
name: "String"
type: topic
aliases: ["Strings"]
source: https://community.bistudio.com/wiki/String
revid: 373361
updated: 2025-04-28T08:59:37Z
---

# String

A **string** is a variable type that contains text. Possible length and characters depend on the game and its version.

> [!NOTE]
> The encoding should be mostly transparent. The input files can be encoded both in UTF-16 or UTF-8, the [toString](../commands/toString.md) and [toArray](../commands/toArray.md) functions always convert from/to UTF-16 representation.

### Properties

|  | OFP | ArmA | Arma 2 | Arma 2:OA | Take On Helicopters | Arma 3 (before v1.56) | Arma 3 (since v1.56) |
|---|---|---|---|---|---|---|---|
| Max length | 2056 | No set limit | 9,999,999 to 10,000,000<br>(same as [Array](../topics/Array.md) length) |  |  |  |  |
| Encoding | [ASCII](https://en.wikipedia.org/wiki/ASCII) | [Unicode](https://en.wikipedia.org/wiki/Unicode) |  |  |  |  |  |
| [Code page](https://en.wikipedia.org/wiki/Code_page) | product language defined | [UTF-8](https://en.wikipedia.org/wiki/UTF-8) |  |  |  |  |  |
| "text" | ✓ |  |  |  |  |  |  |
| 'text' | ✗ | ✓ |  |  |  |  |  |
| {text} | ✓ | ✗ |  |  |  |  |  |

### Commands and Functions

- String Scripting Commands
- String Functions

### Single quote limitation

Strings can be written with both double quotes ("text") and single quotes ('text'). While they are identical, there are slightly differences in how they are treated:
- Single quote strings are [parsed by the preprocessor](../topics/PreProcessor_Commands.md#strings) and may cause undesired results.
- Single quote strings do not seem to support tabs:

```sqf
_string = "    
    ";
copyToClipboard _string;
diag_log format ["%1 %2 %3 x%4x", toArray _string, toArray copyFromClipboard, toArray (_string select [0]), _string];

/*
    return is good: "[9,10,9] [9,10,9] [9,10,9] x    
    x"
*/
```

```sqf
_string = '    
    ';
copyToClipboard _string;
diag_log format ["%1 %2 %3 x%4x", toArray _string, toArray copyFromClipboard, toArray (_string select [0]), _string];

/*
    return: "[9,10] [9,10] [9,10] x    
x" - second tab vanished
*/
```

Example courtesy of [Rydygier](http://forums.bistudio.com/member.php?81568-Rydygier)

### Examples

#### Quotes in Quotes

```sqf
private _string = "my string ""with"" quotes";
private _string = 'my string "with" quotes';
private _string = 'my string with quotes';
```

#### String Formats

```sqf
// Operation Flashpoint
_string = "Hello there" // works
_string = 'Hello there' // does NOT work
_string = {Hello there} // works
```

```sqf
// since Armed Assault
_string = "Hello there" // works
_string = 'Hello there' // works
_string = {Hello there} // does NOT work
```

#### Operators

```sqf
private _finalString = "Hello" + " " + "there"; // outputs "Hello there" - the + sign concatenates strings
```

The only basic operator to be used on strings is "plus". You can use "plus" to concatenate two strings.

#### Conversion

```sqf
private _value = 42; // this is a Number
hint _value; // error - hint takes a String, not a Number
hint format ["%1", _value]; // ok
hint str _value; // ok - since Armed Assault
```

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