Created
October 9, 2011 09:49
-
-
Save rrgroovy/1273511 to your computer and use it in GitHub Desktop.
部分文字列を取り出す
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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