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

Invert GMLscripts.com

string_reverse

Returns a given string with the characters in reverse order.

s = string_reverse("hello, world!");    //  "!dlrow ,olleh"
s = string_reverse("\t\r\n");           //  "\n\r\t"
s = string_reverse(" n\r\t\ ");         //  " \t\rn "
string_reverse(str)
Returns a given string with the characters in reverse order.
COPY/// @func   string_reverse(str)
///
/// @desc   Returns a given string with the characters in reverse order.
///
/// @param  {string}    str         string to be reversed
///
/// @return {string}    reversed string
///
/// GMLscripts.com/license

function string_reverse(str)
{
    var out = "";
    for(var i=string_length(str); i>0; i--) {
        out += string_char_at(str, i);
    }
    return out;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw