Kinda cheated for one line but it works: var s:String = t.toLowerCase().replace(/-([a-z])/g, function():String { return arguments[1].toUpperCase();});
On Mon, Mar 16, 2009 at 11:44 AM, jimmy5804 <jimmy5...@yahoo.com> wrote: > > This seems simple, but I can't figure it out. > > I have some input I don't control with a lot of properties that look like > "xx-yyy" that I want to camelcase: "xxYyy" and I'd like to do this with a > one-line replace() instead of a longer split/join approach. I've tried > several variations of: > > var s:String = t.replace(/-([a-z])/g, "$1".toUpperCase()); > > I've also tried making the second param a function that returns uppercase, > but replace() doesn't do the group substitution in this case. > > Can this be done? > > > -- Beau D. Scott Software Engineer