How to split a string and get first words?
studentController.groovy
def student = {
def ex = new ArrayList()
ex[0]= "Steven | ABCDEF0123456"
ex[1]= "Steven | ABCDEF0123456"
//student's value
[studentlist:ex] //send to gsp
}
student.gsp
<g:each in="${studentlist}" status="i" var="stdnt">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
<td>${stdnt}</td> //i want this show "Steven"
<td>${stdnt}</td> // and this show ABCDEF0123456
</tr>
</g:each>
How can I get the first word and second word?