To remove the first character of a string we can use Groovy’s range index notation. def name = ‘GROOVY’ def substring = name[1..-1] assert substring == ‘ROOVY’
Posts Tagged ‘Substring’
Remove the last character of a string
June 1st, 2010
No Comments
To remove the last character of a string we can use Groovy’s range index notation. def name = ‘GROOVY’ def substring = name[0..-2] assert substring == ‘GROOV’
