Link to home
Start Free TrialLog in
Avatar of MJ
MJFlag for United States of America

asked on

Capture piece of tokenized string?

If I have the below code, is there any way to set the tokens to different  variable names?  For example anything other than doing something like this (if this even works)?

<% int cnt = 1; %>

<c:set var="string">LastName,FirstName</c:set>
<c:forTokens delims="," items="${string}" var="name">
     <c:set var="new_value" value="${name}<%= cnt %>" />
<% cnt++; %>
</c:forTokens>
Avatar of MJ
MJ
Flag of United States of America image

ASKER

Correction:
]
<% int cnt = 1; %>

<c:set var="string">LastName,FirstName</c:set>
<c:forTokens delims="," items="${string}" var="name">
     <c:set var="new_value<%= cnt %>" value="${name}" />
<% cnt++; %>
</c:forTokens>
ASKER CERTIFIED SOLUTION
Avatar of suprapto45
suprapto45
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial