Need to split the string with hyphen

I have " 40899757845". I need to split the string with by hyphen after 3rd character using jstl function.

Please help me.

Thanks in advance
gaurihAsked:
Who is Participating?
 
rrzConnect With a Mentor Commented:
Try this.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="num" value="40899757845" />
${fn:substring(num,0,3)}-${fn:substring(num,3,fn:length(num))}

Open in new window

0
All Courses

From novice to tech pro — start learning today.