I have a string like this "Promote by [email protected]" and I want to get the "abc" substring.
If I try individually,
${fn:subStringAfter("Promote by [email protected]", "by ")} gives "[email protected]"
Now I also want to eliminate the part after '@'.
I tried nesting the JSTL functions like this:
${fn:substringBefore(${fn:substringAfter("Promote by [email protected]", "by ")}, "@")}
But nesting doesn't work. Only substringBefore and subStringAfter will work individually.
Is there any way to do this?
Simply use a variable to store your string manipulation function:
<c:set var = "yourString" value = "${fn:subStringAfter("Promote by [email protected]", "by ")} " />
<c:set var = "yourString" value = "${fn:substringBefore(yourString, '@')}" />
Now yourString
is set with the desired value.