For Programmers: Free Programming Magazines  


Home > Archive > Tcl > August 2004 > Re: [string totitle "ab cd ef"] does not output "Ab Cd Ef" but in









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [string totitle "ab cd ef"] does not output "Ab Cd Ef" but in
Jules

2004-08-27, 8:58 am

Ok, no more confusing strings with lists...
Would there be any divantage if you turn the string into a list
first and join the result into a string?

proc wordsToTitle {string} {
foreach item [split $string] {lappend output [string totitle $item]}
return [join $output]
}

It doesn't remove spaces and it's still faster than subst/regsub.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com