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

Invert GMLscripts.com

string_ucfirst

Returns a string with the first character capitalized.

s = string_ucfirst("hello, world!");    //  "Hello, world!"
s = string_ucfirst("HELLO, WORLD!");    //  "HELLO, WORLD!"
s = string_ucfirst("12345");            //  "12345"
s = string_ucfirst("");                 //  ""
string_ucfirst(str)
Returns a string with the first character capitalized.
COPY/// @func   string_ucfirst(str)
///
/// @desc   Returns a string with the first character capitalized.
///
/// @param  {string}    str         string of text
///
/// @return {string}    capitilized string
///
/// GMLscripts.com/license

function string_ucfirst(str)
{
    var out = string_upper(string_char_at(str, 1));
    out += string_copy(str, 2, string_length(str) - 1);
    return out;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw