Skip to content

Instantly share code, notes, and snippets.

@cheald
Created November 6, 2014 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheald/07bb1729fee1cd892bbd to your computer and use it in GitHub Desktop.
Save cheald/07bb1729fee1cd892bbd to your computer and use it in GitHub Desktop.
> "テスト’[ruby-core:62842] [Bug #9882]".slice(4..-1)
=> "[ruby-core:62842] [Bug #9882]"
> String.new("\u{30c6 30b9 30c8 2019}#{'[ruby-core:62842] [Bug #9882]'}").slice(4..-1)
=> "[ruby-core:62842] [Bug #9882]"
> bug9882 = '[ruby-core:62842] [Bug #9882]'
=> "[ruby-core:62842] [Bug #9882]"
> str = String.new("\u{30c6 30b9 30c8 2019}#{bug9882}")
=> "テスト’[ruby-core:62842] [Bug #9882]"
> str.slice(4..-1)
=> "\x82\xB9ト’[ruby-core:62842] [Bug #9882]"
> bug9882.ascii_only?
=> true
> str.ascii_only?
=> true
> "テスト’[ruby-core:62842] [B#9882]".ascii_only?
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment