thehoule64 thehoule64 - 3 years ago 263
Groovy Question

Splitting String with delimiter

I am currently trying to split a string

so that I can have two separate values ex: value1:1128 and value2:2 so that I can then use each value separately. I have tried
but with no success. Is there a specific way grails handles this or a better way of doing it?

Answer Source


def (value1, value2) = '1128-2'.tokenize( '-' )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download