ruby - How can I extract part of a string that is in quotes -


say have string:

foo = "this string 'with string inside it!'" 

how extract 'with string inside it!' foo?

foo = "this string 'with string inside it!'" foo[foo.index("'")..foo.rindex("'")] #=> "'with string inside it!'" 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -