// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Creation Date: November 28, 2002 // // // // // // string capitalizeString(string $s) // // // Capitalize a string. Take the first character of a string // and convert it to uppercase. // // // string $s String to capitalize. // // // string : Capitalized version of string. // // // // capitalizeString("maya") // // Result: "Maya" // // // // global proc string capitalizeString(string $s) { string $capitalized = ""; if ("" != $s) { // Get the first letter. // string $firstCharacter = `substring $s 1 1`; // Get the rest of the string (not including first letter). // int $length = size($s); string $restOfString = ""; if ($length > 1) { $restOfString = `substring $s 2 $length`; } // Capitalize first letter. // $firstCharacter = `toupper $firstCharacter`; // Reassemble the string with the capitalized first letter and // the rest of the string. // $capitalized = $firstCharacter + $restOfString; } return $capitalized; }