Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jstl Remove all whitespaces from a string

Tags:

jstl

I am trying to remove all whitespaces from a jstl variable.

<c:set var="string1" value="This is first String         "/>

Trim only removes the trailing spaces but I want the output like:

"ThisisfirstString "

with all spaces removed.Could anyone suggest?

like image 877
Jeets Avatar asked Dec 26 '14 11:12

Jeets


1 Answers

Okay I got the answer:

<c:set var="string1" value="This is first String."/>
<c:set var="string2" value="${fn:replace(string1,' ', '')}" />
like image 70
Jeets Avatar answered Dec 31 '22 18:12

Jeets