I’m building a web app with RoR. How do I take this:
<b>this is my text</b>
and capitalize the first word, so it looks like this
<b>This is my text</b>
I have tried using the capitalize method, but it doesn’t work on HTML. Is there any way to do this, preferably without have to install any extra gems?
(For what it’s worth, the string ONLY ever contains a <b> tag and text.)
Might not be the most elegant solution but should do the job:
If there is only <b> at the beginning. You might want to use regular expressions to find the first character.