删除字符

Delete characters

我正在尝试在每次迭代之间使用分隔符。问题是在最后一次迭代中我得到了最后一个 //

示例:18000 → 32768 // 22 → 32769 //

我要:18000 → 32768 // 22 → 32769

 <c:forEach var="port" items="${container.ports}">
    ${port.privatePort} &rarr; ${port.publicPort} //
 </c:forEach>

试一试:

<c:forEach var="port" items="${container.ports}">
    <c:when test=”${not status.last}”>
        ${port.privatePort} &rarr; ${port.publicPort} //
    </c:when>
    <c:otherwise>
        ${port.privatePort} &rarr; ${port.publicPort}
    </c:otherwise>
</c:forEach>

或者:

<c:forEach var="port" items="${container.ports}">
        ${port.privatePort} &rarr; ${port.publicPort} <c:if test="${!loop.last}">//</c:if>
</c:forEach>