/ Published in: Rails
Expand |
Embed | Plain Text
def remove_q_n_trim str return str.gsub(/"|^ +| $+|\n/i,'').to_s end
Comments
Subscribe to comments
You need to login to post a comment.
def remove_q_n_trim str return str.gsub(/"|^ +| $+|\n/i,'').to_s end
Subscribe to comments
You need to login to post a comment.
I tried it with the string " \" hello " and it didn't remove the two spaces before the "h".
How about: def removequotesand_spaces(str) str.gsub("\"","").strip end
I tried it with the string " \" hello " and it didn't remove the two spaces before the "h".
How about: def removequotesand_spaces(str) str.gsub("\"","").strip end
def removeqntrim str return str.gsub(/"|^ | $|\n/i,'').tos end
added new line removing
def removeqntrim str return str.gsub(/"|^ +| $+|\n/i,'').tos end
to TOM:
now it must remove 2 and more spaces in the left and right of the string (added '+')