Skip to content

Instantly share code, notes, and snippets.

@rrgroovy
Created October 9, 2011 09:49
Show Gist options
  • Save rrgroovy/1273511 to your computer and use it in GitHub Desktop.
Save rrgroovy/1273511 to your computer and use it in GitHub Desktop.
部分文字列を取り出す
// 1. String#substringを使う。
assert '0123456'.substring(2, 4) == '23'
// 2. Object#getAtで範囲を使う。 (GDK)
assert '0123456'[2..3] == '23'
assert '0123456'[2..<4] == '23'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment