use(StringUtils) {Not only that but the JetGroovy plugin for IntelliJ IDEA will autocomplete all the new String methods inside the use block.
println 'i can has cheezburger'.substringAfter('i can has ') // prints 'cheezburger'
}
Showing posts with label categories. Show all posts
Showing posts with label categories. Show all posts
Friday, 14 November 2008
Fun With Groovy Categories
Just a quick stupid trick I discovered. Commons Lang's StringUtils class works quite nicely as a category for String, e.g.
Subscribe to:
Posts (Atom)