Reputation: 1
How can I do the same as the following PHP snippet in JSP?
$to_len = count(explode(",",$to));
Basically, it splits a variable with the name to
on delimiter ,
and then counts the parts.
Upvotes: 0
Views: 2235
Reputation: 597204
Using JSTL functions:
${fn:length(fn:split(to, ','))}
Another way is through scriptlets, but it is not recommended - to.split(",").length()
Upvotes: 1