LoginSignup
2
0

More than 5 years have passed since last update.

Rubyの意外と知られていないかもしれない"?文字"

Posted at

Rubyだと?a'a'は同じになるってことだけです。(はてなの後ろは一文字の文字だけがかけます)これを使うと少しタイプ数が少なくなります。

a-Zまでの文字列を作る例:

[*?a..?z, *?A..?Z].join
=> "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

あんまり使われているとこを見ない気がするので書いてみました。

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0