ruby enclose selected whole words in brackets
Posted
by astropanic
on Stack Overflow
See other posts from Stack Overflow
or by astropanic
Published on 2010-05-08T08:38:21Z
Indexed on
2010/05/08
8:48 UTC
Read the original article
Hit count: 184
@string = "Sometimes some stupid people say some stupid words"
@string.enclose_in_brackets("some") # => "Sometimes {some} stupid people say {some} stupid words"
How should the method enclose_in_brackets look ? Please keep in mind, I want only enclose whole words, (I don't want "{Some}times {some} stupid....", the "sometimes" word should be left unchanged
© Stack Overflow or respective owner