SHOW:
|
|
- or go back to the newest paste.
| 1 | - | String.metaClass.methods[0..3].each{ method ->
|
| 1 | + | def text = 'hello world!' |
| 2 | - | println method.name |
| 2 | + | |
| 3 | - | } |
| 3 | + | String.metaClass.camelize = {
|
| 4 | delegate.split().inject(""){ before, word ->
| |
| 5 | before += word[0].toUpperCase() + word[1..-1] | |
| 6 | } | |
| 7 | } | |
| 8 | assert text.camelize() == "HelloWorld!" |