Method code for $english_lib.capitalize()

[Turn off line numbering]
  1: arg str;
  2: var m, word;
  3: 
  4: // capitalize the first character of the first alphanumeric word found,
  5: // if it is not in the exceptions list.  Example:
  6: //
  7: //    $english_lib.capitalize(" @foo") => " @Foo"
  8: //
  9: if (!(m = regexp(str, "[a-z]+")))
 10:     return str;
 11: word = m[1].capitalize();
 12: anticipate_assignment();
 13: return word in capitalize_exceptions ? str : strsed(str, "[a-z]+", word);

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

Tlon