---
name: "parseText"
type: command
status: ok
groups: ["Strings", "Structured Text"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/parseText
revid: 364995
updated: 2024-07-04T19:58:06Z
---

# parseText

*Command · Strings, Structured Text · Arma 3 v0.50 · introduced in Operation Flashpoint: Elite v1.00*

## Description

Creates a structured text by parsing the given XML description. Do not use [parseText](../commands/parseText.md) when displaying a localized text from Stringtable.xml.

A detailed explanation of all formatting possibilities can be found at [Structured Text](../topics/Structured_Text.md).

## Syntax

```sqf
parseText text
```

**Parameters:**

- `text`: [String](../topics/String.md)

**Returns:** [Structured Text](../topics/Structured_Text.md)

## Examples

### Example 1

```sqf
private _Stxt = parseText "First line<img image='data\isniper.paa'/><br/>Second line";
```

### Example 2

```sqf
hintSilent parseText format["<t size='1.25' font='Zeppelin33' color='#ff0000'>%1 lives remaining.</t>", 12];
```

### Example 3

```sqf
private _clickableLink = parseText "<a href='http://arma3.com'>A3</a>";
```

## See also

[Structured Text](../topics/Structured_Text.md) · [composeText](../commands/composeText.md) · [text](../commands/text.md) · [localize](../commands/localize.md) · [ctrlSetStructuredText](../commands/ctrlSetStructuredText.md)

## Community notes

**Dr_Eyeball** — 2016-09-01

To convert a structured text back to a string type, just use:

```sqf
_str = str parseText _structuredText;
```

---

**AgentRev** — 2017-09-01

If you are parsing user-defined strings like player names, you may want to convert special characters to their [XML entities](https://en.wikipedia.org/wiki/Character_encodings_in_HTML#XML_character_references) as a precaution beforehand, otherwise the result might be corrupted.

```sqf
private _escapeXML =
{
    _this
    regexReplace ["&", "&"]
    regexReplace ["<", "<"]
    regexReplace [">", ">"]
    regexReplace ['"', """]
    regexReplace ["'", "'"]
};

private _name = '<A&M> Paul "Bear" Bryant';
private _escapedName = _name call _escapeXML;
private _redName = parseText format ["<t color='#ff0000'>%1</t>", _escapedName];
```

---

**Sa-Matra** — 2023-10-13

Here is a useful script snippet to safely use angled braces and ampersand in structured texts:

```sqf
_string regexReplace ["&", "&"] regexReplace ["<", "<"]
```

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