> For the complete documentation index, see [llms.txt](https://hrscripts.gitbook.io/hrscripts-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hrscripts.gitbook.io/hrscripts-documentation/resources/hrlib/modules/string/shared.md).

# Shared

## string.split

Function to split text by delimiter

```lua
function HRLib.string.split(
    text: string,
    delimiter: string,
    returnAllAs: 'string'|'number'?,
    isArray: boolean?
): ...|string[]|number[]
```

Parameters description

* `text` - the text to split
* `delimiter` - the delimiter
* `returnAllAs` - sets what to return the values as (if you choose 'number' and one or more of the values can't be number, it will return the string version, if nil, it will be the default, to return as string)
* `isArray` - sets whether or not the return value must be multiple values of the splitted string or an array full of the splitted parts

## string.gather

Function to combine multiple strings into one with delimiter

```lua
function HRLib.string.gather(source: string[], delimiter: string?): string? result
```

Parameters description

* `source` - list of strings to combine
* `delimiter` - the delimiter between the strings in the main one

Return description

* `result` - the combined string or nil if there's no `source`&#x20;
