Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///@func string_fill(string, template, str1, str2, ...
- ///@desc Replaces template substrings (e.g. "%%"), with given strings, thus 'completing' the string
- /// Example: greeting = "%%, my name is %%!";
- /// greeting = string_fill(greeting, "%%", "Hi", "Mike");
- ///
- /// Result: "Hi, my name is Mike"
- ///
- ///@param string
- ///@param template
- ///@param str1
- ///@param str2
- ///@param ...
- var _string = argument[0];
- var _template = argument[1];
- for (var _i = 2; _i < argument_count; _i++)
- _string = string_replace(_string, _template, string(argument[_i]));
- return _string;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement