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

Invert GMLscripts.com

string_split

string_split(str,num,break)
Returns a string with break characters inserted at a given interval.
COPY/// string_split(str,num,break)
//
//  Returns a string with break characters inserted at a given interval.
//
//      str         text, string
//      num         number of characters before a break, real
//      break       characters to insert, string
//
/// GMLscripts.com/license
{
    var str,num,brk,len,i;
    str = argument0;
    num = argument1;
    brk = argument2;
    if (num < 1) num = 76;
    if (is_real(brk)) brk = "#";
    len = string_length(str);
    for (i=len-((len-1) mod num); i>num; i-=num) {
        str = string_insert(brk,str,i);
    }
    return str;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw