From: matt@... (matt neuburg) Date: 2009-06-05T05:50:05+09:00 Subject: Re: How to capitalize first word of a string? Rails List wrote: > I have a string that I would like to capitalize and add bold html tag to > the first word only. How do i do it?. Do I have to split first and > then "upcase!" it then join again. Not sure how to do it. any help is > much appreciated. thanks Sure, that's a good way. A little-known feature of "split" is the "limit" parameter, so you can split off just the first word without affecting anything else: arr = s.split(" ", 2) arr[0].upcase! # and anything else you feel like s = arr.join(" ") m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com