开发者

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜