This function takes as input an array of string handles as well as a delimiter and concatenates the array elements into one delimited string. Example: array arr = {"A", "B", "", "D"}; string str = join(arr, "|"); The resulting string is: "A|B||D" AngelScript signature: string join(const array &in arr, const string &in delim)
| 80 | // AngelScript signature: |
| 81 | // string join(const array<string> &in arr, const string &in delim) |
| 82 | static string StringJoin(const CScriptArray &array, const string &delim) |
| 83 | { |
| 84 | // Create the new string |
| 85 | string str = ""; |
| 86 | if( array.GetSize() ) |
| 87 | { |
| 88 | int n; |
| 89 | for( n = 0; n < (int)array.GetSize() - 1; n++ ) |
| 90 | { |
| 91 | str += *(const string*)array.At(n); |
| 92 | str += delim; |
| 93 | } |
| 94 | |
| 95 | // Add the last part |
| 96 | str += *(const string*)array.At(n); |
| 97 | } |
| 98 | |
| 99 | return str; |
| 100 | } |
| 101 | |
| 102 | static void StringJoin_Generic(asIScriptGeneric *gen) |
| 103 | { |
no test coverage detected