Randomly Bolding Words in Centered Text -- How to do this? [Time Senstive - Next 48 hours]
in
Programming Questions
•
3 years ago
I'm working on a project that involves generating (preselected) text to fit inside of (predesigned) word bubbles. So far, so good, and I already meet the homework's requirements.
However, to give it that last bit of comic "oomph", I want to be able to bold random words in the string. This is a bit of a problem since the text is centered to begin with, so I can't just swap out for a bolder font midway through the string. Like so:
However, to give it that last bit of comic "oomph", I want to be able to bold random words in the string. This is a bit of a problem since the text is centered to begin with, so I can't just swap out for a bolder font midway through the string. Like so:
- The strings \n are currently formatted \n like this with newline \n escapes.
The strings
are currently formatted
like this with newline
escapes.
are currently formatted
like this with newline
escapes.
Formatting is (Center, Center), which makes hard-coding a text location that can be bolded / unbolded at will a little difficult. I know that there's a function that can parse the string character by character, but aside from being able to parse out specific words based on whitespace, I'm not sure I can use this.
Help?
Help?
1