# SString

**成员** 11

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

## 静态函数

### MD5

static string MD5(string input)

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

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**Lua**

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

```

### SHA1

static string SHA1(string input)

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**Lua**

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

```

### Replace

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

参数

| 名称    | 类型   | 默认值 |
| ------- | ------ | ------ |
| old     | string | –      |
| pattern | string | –      |
| replace | string | –      |

返回值

`string`

示例

**Lua**

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

```

### GenerateGUID

static string GenerateGUID()

返回值

`string`

示例

**Lua**

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

```

### Base64Encode

static string Base64Encode(string input)

Converts input to Base64 and returns the result

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**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

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**Lua**

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

```

### GetBytes

static byte\[] GetBytes(string input)

Converts input to bytes using UTF8 encoding

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`byte[]`

示例

**Lua**

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

```

### GetString

static string GetString(byte\[] bytes)

Converts input to a UTF8 string

参数

| 名称  | 类型    | 默认值 |
| ----- | ------- | ------ |
| bytes | byte\[] | –      |

返回值

`string`

示例

**Lua**

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

```

### EncodeURL

static string EncodeURL(string input)

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**Lua**

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

```

### DecodeURL

static string DecodeURL(string input)

参数

| 名称  | 类型   | 默认值 |
| ----- | ------ | ------ |
| input | string | –      |

返回值

`string`

示例

**Lua**

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

```

### RegexMatchResult

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

参数

| 名称        | 类型   | 默认值 |
| ----------- | ------ | ------ |
| input       | string | –      |
| pattern     | string | –      |
| replacement | string | –      |

返回值

`string`

示例

**Lua**

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

```
