Last active
December 22, 2015 03:52
-
-
Save javagrails/1b7e6e41f893bfb34b68 to your computer and use it in GitHub Desktop.
Groovy String Operation Examples
This file contains hidden or 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
//How to get last 2/5 digit/char from a String | |
static main(args) { | |
String texter = "5793231309" | |
String texter2 = texter[-2..-1] | |
String texter5 = texter[-5..-1] | |
println(texter2) // 09 | |
println(texter5) // 31309 | |
} | |
// YOU CAN RUN CODE ONLINE HERE | |
// http://groovyconsole.appspot.com/ | |
// http://www.tutorialspoint.com/execute_groovy_online.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
YOU CAN RUN CODE ONLINE HERE

groovyconsole
execute_groovy