> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parser

> A template engine. A Parser instance can set template variable values, then parse a formatted string containing template variable placeholders to replace their values.

A template engine. A Parser instance can set template variable values, then parse a formatted string containing template variable placeholders to replace their values.

## Constructors

### Parser()

```crmscript theme={null}
Parser
```

Initializes a new instance of the Parser class.

## Methods

## addVariable(String,String)

Adds a variable and its value to the parser.

```crmscript theme={null}
Void addVariable(String field, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

## evaluateString(String)

Parses a text and return the evaluated result from a RETURN statement inside the text.

```crmscript theme={null}
String evaluateString(String stringToParse)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - Any string set by a RETURN statement inside stringToParse.

## getVariable(String,Integer)

Returns the value at the given index with the given name from the Parser instance.

```crmscript theme={null}
String getVariable(String name, Integer row)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The value at the given index with the given name.

## getVariableCount(String)

Returns the number of values for the given variable in the Parser instance.

```crmscript theme={null}
Integer getVariableCount(String name)
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer) - The number of values of the given variable.

## parseString(String)

Parses a text and return the result.

```crmscript theme={null}
String parseString(String stringToParse)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The parsed result.

## setVariable(String,String)

Sets the variable with the given name to the given value in the Parser instance.

```crmscript theme={null}
Void setVariable(String name, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  Existing values will be overwritten with this new value.
</Note>

## toParser(Parser)

Copies all values in the input parser to the original parser.

```crmscript theme={null}
toParser(Parser parser)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)


## Related topics

- [Parser](/en/automation/crmscript/parser.md)
- [Ticket](/en/automation/crmscript/reference/CRMScript.Native.Ticket.md)
- [Reply to customer](/en/automation/crmscript/howto/request/reply.md)
- [Void](/en/automation/crmscript/reference/CRMScript.Global.Void.md)
- [Requests](/en/request/dev/index.md)
- [Customer](/en/automation/crmscript/reference/CRMScript.Native.Customer.md)
