# String

## MSK.String.Random

Generate a Random String

<mark style="color:red;">**Parameters**</mark>\
**length** - `number` - The Length of the string

<mark style="color:green;">**Returns**</mark>\
**text** - `string` - The Text of the given length

```lua
local text = MSK.String.Random(length)

-- Example
local text = MSK.String.Random(3) -- abc
local text = string.upper(MSK.String.Random(3)) -- ABC

-- As an Export:
local text = exports.msk_core:GetRandomString(length)
```

## MSK.String.StartsWith

Checks if the given string start with the given string

<mark style="color:red;">**Parameters**</mark>\
**text** - `string` - Text that should be checked\
**letter** - `string` - Letter to search for

<mark style="color:green;">**Returns**</mark>\
**startsWith** - `boolean` - Whether the text starts with the given letter

```lua
local text = 'Hello'
local startsWith = MSK.String.StartsWith(text, 'H') -- Returns true
local startsWith = MSK.String.StartsWith(text, 'e') -- Returns false

-- As an Export:
local text = exports.msk_core:StartsWith(text, letter)
```

## MSK.String.Trim

Removes SPACEs in a string

<mark style="color:red;">**Parameters**</mark>\
**text** - `string` - Text that should be trimmed\
**hardtrim** - `boolean` - All spaces will be trimmed - **Optional**

<mark style="color:green;">**Returns**</mark>\
**trimmed** - `string` - The trimmed text

```lua
local trimmed = MSK.String.Trim(text, hardtrim)

-- Example
local text = ' Hello World '

-- Removes leading and trailing spaces
MSK.String.Trim(text) -- Output: 'Hello World'

-- Removes ALL spaces
MSK.String.Trim(text, true) -- Output: 'HelloWorld'

-- As an Export:
local text = exports.msk_core:Trim(text, hardtrim)
```

## MSK.String.Split

Splits a string into two different strings

<mark style="color:red;">**Parameters**</mark>\
**text** - `string` - Text that should be splitted\
**delimiter** - `string` - Delimiter where should the text be splitted

<mark style="color:green;">**Returns**</mark>\
**result** - `table` - Includes the splitted string

```lua
local text = 'license:12345678'
local result = MSK.String.Split(text, ':')
print(result[1], result[2]) -- Output: license, 12345678

-- As an Export:
local result = exports.msk_core:Split(text, delimiter)
```
