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

Invert gmlscripts.pro

string_right

right = string_right("Hello World", 4);   //  right == "orld"
right = string_right("Hello World", -4);  //  right == "o World"
string_right(str,num)
Returns a number of characters from the end of a string.
COPY/// string_right(str,num)
//
//  Returns a number of characters from the end of a string.
//  If the number of characters given is negative,
//  the string will be shortened by that amount.
//
//      str         string of text, string
//      num         number of characters, real
//
/// gmlscripts.pro/license
{
    if (argument1 < 0)
        return string_copy(argument0, 1 - argument1, string_length(argument0) + argument1);
    else
        return string_copy(argument0, 1 + string_length(argument0) - argument1, argument1);
}

Contributors: xot

GitHub: View · Commits · Blame · Raw