MCPcopy Create free account
hub / github.com/anjo76/angelscript / StringJoin

Function StringJoin

sdk/add_on/scriptstdstring/scriptstdstring_utils.cpp:82–100  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

80// AngelScript signature:
81// string join(const array<string> &in arr, const string &in delim)
82static 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
102static void StringJoin_Generic(asIScriptGeneric *gen)
103{

Callers 1

StringJoin_GenericFunction · 0.85

Calls 2

GetSizeMethod · 0.45
AtMethod · 0.45

Tested by

no test coverage detected