I am looking for fast and good way to add “-” before every word in string. For example “bla bla bla” should become “-bla -bla -bla”.
I don’t want to make an array of this string, then map it, etc. It looks like a wrong and slow way.
Do you have any suggestions on this?
I am looking for fast and good way to add – before every word
Share
If we assume that a word is always separated by a whitespace and that the whitespace have no other special meaning we can do:
Output: