Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 767
  • Last Modified:

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
0
gaurih
Asked:
gaurih
1 Solution
 
rrzCommented:
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now