can me, how remove trailing white spaces each line in string in ruby.... example:
str = "hello everyone. \nhope guys doing \nstrange can't remove spaces" i tried rstrip not working me.... may have try gsub.... want answer in below wayy.
"hello everyone.\nhope guys doing good\nstrange can't remove spaces"
str.split("\n").map(&:rstrip).join("\n") its doable regex prefer way.
Comments
Post a Comment