Jstl Remove all spaces from a string

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

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

Trim only removes trailing spaces, but I want the result to look like this:

"ThisisfirstString"

with all remote spaces. Can anyone suggest?

+4
source share
1 answer

Ok, I got the answer:

<c:set var="string1" value="This is first String."/>
<c:set var="string2" value="${fn:replace(string1,' ', '')}" />
+7
source

Source: https://habr.com/ru/post/1569045/


All Articles