Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

string_implode

By Daniel · December 24, 2008

Joins together multiple strings (pieces) into one combined string

// string_implode(delimiter, pieces)
// Joins together multiple strings (pieces) into one combined string
// delimiter: the string to be inserted between each piece
// pieces: a list of pieces to join together

var delimiter, pieces, size, result;

delimiter = argument0;
pieces = argument1;
size = ds_list_size(pieces);
result = '';

for (i = 0; i < size; i += 1) {
  if (result != '')
    result += delimiter;
  result += ds_list_find_value(pieces, i);
}

return result;

Categories: String handling

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement