# StringSet

The **StringSet** object is container that stores one or more unique strings. It is similar to an array or vector (e.g. [**Vector**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/vector)) but has the advantage of using a dictionary system to locate strings rather than numeric indexes. You can therefore lookup strings much more quickly than by linearly searching a [**Vector**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/vector).

You can create a new **StringSet** using the \*\*[DOpusFactory](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/dopusfactory)\*\*object. A **StringSet** can be either case-sensitive ("cat" and "CAT" would be treated as two different strings) or case-insensitive.

| Property Name | Return Type | Description                                                       |
| ------------- | ----------- | ----------------------------------------------------------------- |
| count         | *int*       | Returns the number of elements the **StringSet** currently holds. |
| empty         | *bool*      | Returns **True** if the **StringSet** is empty, **False** if not. |
| length        | *int*       | A synonym for **count**.                                          |
| size          | *int*       | A synonym for **count**.                                          |

| Method Name | **Arguments**        | Return Type | Description                                                                                                                                                                                                                         |
| ----------- | -------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| assign      | <**StringSet**:from> | *none*      | Copies the contents of another **StringSet** to this one. You can also pass an array of strings or [**Vector**](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/vector) object. |
| clear       | *none*               | *none*      | Clears the contents of the **StringSet**.                                                                                                                                                                                           |
| erase       | \<string>            | *none*      | Erases the string if it exists in the set.                                                                                                                                                                                          |
| exists      | \<string>            | *bool*      | Returns **True** if the specified string exists in the set.                                                                                                                                                                         |
| insert      | \<string>            | *bool*      | Inserts the string into the set if it doesn't already exist. Returns **True** if successful.                                                                                                                                        |
| merge       | <**StringSet**:from> | *none*      | Merges the contents of another **StringSet** with this one.                                                                                                                                                                         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_objects/stringset.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
