MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 2 | string implode(string *arr, string del) |
| 3 | bytes implode(bytes *arr, bytes del) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 5 | DESCRIPTION |
| 6 | Concatenate all strings found in array arr, with the string |
| 7 | del between each element. Only strings are used from the array. |
| 8 | Works similar with arrays of byte sequences. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 10 | EXAMPLES |
| 11 | function returns |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | ------------------------------------------------------------------- |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 13 | implode(({ "foo", "bar", "" }), "*") "foo*bar*" |
| 14 | implode(({ "a", 2, this_object(), "c" }), "b") "abc" |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 15 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 16 | Together with explode() this can be used as a search and replace |
| 17 | function of strings: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 18 | implode(explode("a short text", " "), "_") "a_short_text" |
| 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | But nowadays you can also use |
| 21 | regreplace("a short text", " ", "_", 1) |
| 22 | instead. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 23 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 24 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 25 | explode(E), regreplace(E) |