// How to truncate a string in groovy?
// https://stackoverflow.com/a/15713996
println "=== Original example ==="
println "abscd adfa dasfds ghisgirs fsdfgf".take(10) //"abscd adfa"
println ""
println "=== .take() ==="
println "It's groovy, man".take(4) //"It's"
println "It's groovy, man".take(10000) //"It's groovy, man" (no exception thrown)
println ""
println "=== .drop() ==="
println "It's groovy, man".drop(-15) //"n"
println "It's groovy, man".drop(5).take(6) //"groovy"
Ly8gSG93IHRvIHRydW5jYXRlIGEgc3RyaW5nIGluIGdyb292eT8KLy8gaHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS9hLzE1NzEzOTk2CnByaW50bG4gIj09PSBPcmlnaW5hbCBleGFtcGxlID09PSIKcHJpbnRsbiAiYWJzY2QgYWRmYSBkYXNmZHMgZ2hpc2dpcnMgZnNkZmdmIi50YWtlKDEwKSAgLy8iYWJzY2QgYWRmYSIKcHJpbnRsbiAiIgpwcmludGxuICI9PT0gLnRha2UoKSA9PT0iCnByaW50bG4gIkl0J3MgZ3Jvb3Z5LCBtYW4iLnRha2UoNCkgICAgICAvLyJJdCdzIgpwcmludGxuICJJdCdzIGdyb292eSwgbWFuIi50YWtlKDEwMDAwKSAgLy8iSXQncyBncm9vdnksIG1hbiIgKG5vIGV4Y2VwdGlvbiB0aHJvd24pCnByaW50bG4gIiIKcHJpbnRsbiAiPT09IC5kcm9wKCkgPT09IgpwcmludGxuICJJdCdzIGdyb292eSwgbWFuIi5kcm9wKC0xNSkgICAgICAgICAvLyJuIgpwcmludGxuICJJdCdzIGdyb292eSwgbWFuIi5kcm9wKDUpLnRha2UoNikgIC8vImdyb292eSIK