How to truncate string in groovy
I used :
def c = truncate("abscd adfa dasfds ghisgirs fsdfgf", 10)
but getting error .
thanks in advance .
How to truncate string in groovy
I used :
def c = truncate("abscd adfa dasfds ghisgirs fsdfgf", 10)
but getting error .
thanks in advance .
In Groovy, strings can be considered as ranges of characters. As a consequence, you can simply use range indexing features of Groovy and do myString[startIndex..endIndex]
.
As an example,
"012345678901234567890123456789"[0..10]
outputs
"0123456789"