deadlock Message Board
[ February Full List | Post A Reply ]

Re: Title Case Function
From Michael Hatch on 14 Feb '02
replying to Re: Title Case Function posted by Michael Hatch

In case anyone has been following this thread, here is the
completed code.

This is a copyrighted work and the intellectual property of the
author. Any reposting or reproduction is strictly prohibited
without the express written permission of the author. (C)2002
Michael Hatch

function titleCase()
var result = "";
var wordArray = this.word.split(" ");
for (var i = 0; i < wordArray.length; i++)
var wordLength = wordArray[i].length;
result += wordArray[i].charAt(0).toUpperCase() +
wordArray[i].substring(1,wordLength).toLowerCase() + " ";

this.word = result;
function titlestr(word)
this.word = word;
this.titleCase = titleCase;
function testwrite()
var testword = new titlestr("test stuff");
var testword2 = new titlestr("single");
var testword3 = new titlestr("now is the time for all good
men to COME to the aid of their party");

document.writeln(testword.word + "<BR>
document.writeln(testword2.word + "<BR>");
document.writeln(testword3.word + "<BR>");


Your Reply

*Your name:
*Message subject:
Home page title:
Home page URL:
(if you'd like to receive automatic replies by email)