Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jujuadams/string_split_moreso

Extended string_split() functions for GameMaker
https://github.com/jujuadams/string_split_moreso

gamemaker gamemaker-studio-2 gms2 string

Last synced: about 2 months ago
JSON representation

Extended string_split() functions for GameMaker

Awesome Lists containing this project

README

        

string_split_moreso

Extended string_split() functions for GameMaker

 

### `string_split_escaped()`

GameMaker's native `string_split()` but with additional support for escape characters.

Examples:
```
string_split_escaped("0#1", "#") -> ["0", "1"]
string_split_escaped("0\\#1", "#") -> ["0#1"]
string_split_escaped("0\\\\#1", "#") -> ["0\", "1"]
```

 

### `string_split_open_close()`

GameMaker's native `string_split()` but using an open and close delimiter. This is useful for handling BBCode-style formatting tags etc. Returned array will have content found between the open and close delimiters stored in odd-numbered indexes in the array.

**N.B.** Tags cannot be nested inside other tags.

Examples:
```
string_split_open_close("0[1]2", "[", "]") -> ["0", "1", "2"]
string_split_open_close("[1]", "[", "]") -> ["", "1", ""]
string_split_open_close("0[1][3][5]6", "[", "]") -> ["0", "1", "", "3", "", "5", "6"]
```

 

### `string_split_open_close_escaped()`

GameMaker's native `string_split()` but using an open and close delimiter and supporting escape characters. This is useful for handling BBCode-style formatting tags etc. Returned array will have content found between the open and close delimiters stored in odd-numbered indexes in the array.

**N.B.** Tags cannot be nested inside other tags.

Examples:
```
string_split_open_close("0[1]2", "[", "]") -> ["0", "1", "2"]
string_split_open_close("[1]", "[", "]") -> ["", "1", ""]
string_split_open_close("\\[0]", "[", "]") -> ["[0]"]
string_split_open_close("0[1][3][5]6", "[", "]") -> ["0", "1", "", "3", "", "5", "6"]
```