How to split a string and count the parts?
How can I do the same as the following开发者_StackOverflow社区 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.
Using JSTL functions:
${fn:length(fn:split(to, ','))}
Another way is through scriptlets, but it is not recommended - to.split(",").length()
精彩评论