# Strings

Provides utility functions for common string operations including casing, trimming, splitting, and generating random strings.

***

## Accessing the Module

```lua
local STRINGS <const> = exports.boii_utils:get("modules.strings")
```

***

## Shared

### capitalize(str)

Capitalizes the first letter of each word in the string.

#### Parameters

| Name | Type     | Description              |
| ---- | -------- | ------------------------ |
| str  | `string` | The string to capitalize |

#### Example

```lua
local result = STRINGS.capitalize("hello world") -- "Hello World"
```

***

### random\_string(length)

Generates a random alphanumeric string of a given length.

#### Parameters

| Name   | Type     | Description                      |
| ------ | -------- | -------------------------------- |
| length | `number` | The desired length of the string |

#### Example

```lua
local id = STRINGS.random_string(8) -- e.g., "aZ82xY0p"
```

***

### split(str, delimiter)

Splits a string into parts using a given delimiter.

#### Parameters

| Name      | Type     | Description               |
| --------- | -------- | ------------------------- |
| str       | `string` | The string to split       |
| delimiter | `string` | The delimiter to split on |

#### Example

```lua
local parts = STRINGS.split("one,two,three", ",") -- parts = {"one", "two", "three"}
```

***

### trim(str)

Trims whitespace from both ends of the string.

#### Parameters

| Name | Type     | Description        |
| ---- | -------- | ------------------ |
| str  | `string` | The string to trim |

#### Example

```lua
local clean = STRINGS.trim("  hello world  ") -- "hello world"
```


---

# 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://docs.boii.dev/old-docs/boii_utils/api/strings.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.
