Method code for $english_lib.capitalize()

[Turn on line numbering]
arg str;
var m, word;

// capitalize the first character of the first alphanumeric word found,
// if it is not in the exceptions list.  Example:
//
//    $english_lib.capitalize(" @foo") => " @Foo"
//
if (!(m = regexp(str, "[a-z]+")))
    return str;
word = m[1].capitalize();
anticipate_assignment();
return word in capitalize_exceptions ? str : strsed(str, "[a-z]+", word);

// Created 11-Nov-1996 as a part of ColdCore, see: @help Credit

Tlon