in this instance, is a[0] = "Neil" and a[1] = "Robertson-Ravo"?

could the punctuation be choking on the toLowerCase?  or is it the
match(pattern) that's ditching your punctuation?


Duncan Cumming
IT Manager

http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600

Creative solutions in a technical world

----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------




                                                                                       
                                           
                    "Robertson-Ravo, Neil (RX)"                                        
                                           
                    <[EMAIL PROTECTED]        To:     "'[EMAIL PROTECTED]'" <[EMAIL 
PROTECTED]>     
                    dexpo.com>                          cc:                            
                                           
                                                        Subject:     [ cf-dev ] JS 
help : OT                                      
                    16/06/2003 16:35                                                   
                                           
                    Please respond to dev                                              
                                           
                                                                                       
                                           
                                                                                       
                                           



Anyone see where I can amend this JS so not to strip out hypens and
punctation etc..?

function UpperCaseLetters(myField) {
                                   var pattern = /(\w)(\w*)/; // a letter,
and then
one, none or more letters
                                   var a = myField.value.split(/\s+/g); //
split
the sentence into an array of words

                                   for (i = 0 ; i < a.length ; i ++ ) {
                             var parts = a[i].match(pattern); // just a
temp
variable to store the fragments in.

                             var firstLetter = parts[1].toUpperCase();
                             var restOfWord = parts[2].toLowerCase();

                             a[i] = firstLetter + restOfWord; // re-assign
it
back to the array and move on
                         }
                         myField.value = a.join(' '); // join it back
together
                     }



basically when I enter the following into a field this : Neil
Robertson-Ravo, its stripping out everything and just leaving Neil, its
fine
if all you put in is Neil - then it does capitalize it to NEIL.

I want it to take into account hypens and punctuation should it need to.

--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]






-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to