# SString

**Members** 11

|          |                                       |                                                                               |
| -------- | ------------------------------------- | ----------------------------------------------------------------------------- |
| Function | [MD5](#md5)                           | Calculates the MD5Sum of input and returns the result as a hexadecimal string |
| Function | [SHA1](#sha1)                         | –                                                                             |
| Function | [Replace](#replace)                   | –                                                                             |
| Function | [GenerateGUID](#generateguid)         | –                                                                             |
| Function | [Base64Encode](#base64encode)         | Converts input to Base64 and returns the result                               |
| Function | [Base64Decode](#base64decode)         | Converts input from Base64 and returns the result                             |
| Function | [GetBytes](#getbytes)                 | Converts input to bytes using UTF8 encoding                                   |
| Function | [GetString](#getstring)               | Converts input to a UTF8 string                                               |
| Function | [EncodeURL](#encodeurl)               | –                                                                             |
| Function | [DecodeURL](#decodeurl)               | –                                                                             |
| Function | [RegexMatchResult](#regexmatchresult) | –                                                                             |

## Static Functions

### MD5

static string MD5(string input)

Calculates the MD5Sum of input and returns the result as a hexadecimal string

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
md5 = Space.String.MD5('AString')

```

### SHA1

static string SHA1(string input)

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
sha1 = Space.String.SHA1('AString')

```

### Replace

static string Replace(string old, string pattern, string replace)

Parameters

| Name    | Type   | Default |
| ------- | ------ | ------- |
| old     | string | –       |
| pattern | string | –       |
| replace | string | –       |

Returns

`string`

Example

**Lua**

```lua
replaced = Space.String.Replace('AString', 'APattern', 'AReplace')

```

### GenerateGUID

static string GenerateGUID()

Returns

`string`

Example

**Lua**

```lua
guid = Space.String.GenerateGUID()

```

### Base64Encode

static string Base64Encode(string input)

Converts input to Base64 and returns the result

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
baseEncodeByte = Space.String.Base64Encode{117, 116, 32, 116, 100, 101})

```

### Base64Decode

static string Base64Decode(string input)

Converts input from Base64 and returns the result

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
baseDecodedStr = Space.String.Base64Decode('aW5wdXQgdG8gZW5jb2Rl')

```

### GetBytes

static byte\[] GetBytes(string input)

Converts input to bytes using UTF8 encoding

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`byte[]`

Example

**Lua**

```lua
stringAsByteArray = Space.String.GetBytes('A String')

```

### GetString

static string GetString(byte\[] bytes)

Converts input to a UTF8 string

Parameters

| Name  | Type    | Default |
| ----- | ------- | ------- |
| bytes | byte\[] | –       |

Returns

`string`

Example

**Lua**

```lua
ByteArrayAsString = Space.String.GetString({115, 111, 109, 101, 32})

```

### EncodeURL

static string EncodeURL(string input)

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
encodedURL = Space.String.EncodeURL('A String')

```

### DecodeURL

static string DecodeURL(string input)

Parameters

| Name  | Type   | Default |
| ----- | ------ | ------- |
| input | string | –       |

Returns

`string`

Example

**Lua**

```lua
decodedURL = Space.String.DecodeURL('A String')

```

### RegexMatchResult

static string RegexMatchResult(string input, string pattern, string replacement)

Parameters

| Name        | Type   | Default |
| ----------- | ------ | ------- |
| input       | string | –       |
| pattern     | string | –       |
| replacement | string | –       |

Returns

`string`

Example

**Lua**

```lua
Space.Math.RegexMatchResult('astring', 'astring','astring')

```
