You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

implode

Returns a string of elements from a given array of strings and separated by a delimiter.

array[0] = "Juliett"
array[1] = "Victor"
array[2] = "Mike"
array[3] = "Charlie"
array[4] = "Romeo"
array[5] = "Oscar"

names = implode(",", array);

//  names == "Juliett,Victor,Mike,Charlie,Romeo,Oscar"
implode(delimiter,array)
Returns a string of elements from a given array of strings and separated by a delimiter.
COPY/// implode(delimiter,array)
//
//  Returns a string of elements from a given array
//  of strings and separated by a delimiter.
//
//      delimiter   delimiter character, string
//      array       group of elements, array
//
/// GMLscripts.com/license
{
    var del = argument0;
    var arr = argument1;
    var out = "";
    var ind = 0;
    var num = array_length_1d(arr);
    repeat (num-1) {
        out += arr[ind] + del;
        ind++;
    }
    out += arr[ind];
    return out;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw