From: Harry Kakueki Date: 2010-07-24T18:40:30+09:00 Subject: Re: how to convert the string? On Fri, Jul 23, 2010 at 10:45 PM, Pen Ttt wrote: > i want to convert a string  "-34\n   \302\240"  into "-34" > irb(main):001:0> "-34\n   \302\240".gsub('\302\240','').strip.chomp > => "-34\n   \302\240" > how to convert it? > thinks for your help. > -- I don't think you are clearly stating your requirements. Also, I think you may be confusing yourself with your first attempt. Try changing your gsub('\302\240','') to gsub("\302\240","") (double quotes) You were sometimes using double quotes and sometimes single quotes. See if that helps you any. Harry