More than 3 years have passed since last update.
a = "\t僕は\r\n元気です"
b = "僕は\t\r\n元気です"
c = "僕は\r\n元気です\t"
みたいな文字列があったときに、\t
だけ除去したい。
こうする。
正規表現よくわかってないけど。
a = "\t僕は\r\n元気です"
b = "僕は\t\r\n元気です"
c = "僕は\r\n元気です\t"
puts a.gsub(/(\t)/,"")
puts b.gsub(/(\t)/,"")
puts c.gsub(/(\t)/,"")
irbで試しちゃった。
Why not register and get more from Qiita?
- We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
- you can read useful information later efficiently
By "stocking" the articles you like, you can search right away
Sign upLogin