... escapetool.xml is my new friend :-/
$stringtool.contains($MyContent,$escapetool.xml('{{box 
cssClass="floatinginfobox" title="**Sommaire**"}}'))



________________________________
 De : Pascal BASTIEN <[email protected]>
À : XWiki Users <[email protected]> 
Envoyé le : Mercredi 8 octobre 2014 16h01
Objet : [xwiki-users] Escape character with $stringtool.contains
 

Hello,

On Xwiki 6.2.1, I'm fighting with $stringtool.contains

http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/StringUtils.html#contains%28java.lang.CharSequence,%20java.lang.CharSequence%29

In my velocity code, I have

#set($MyContent=$escapetool.xml($recentDoc.content))

$MyContent return

{{box cssClass="floatinginfobox" title="**Sommaire**"}} {{toc numbered="true" 
depth="3"/}} {{/box}} {{numberedheadings/}} Bla bla

I want to check if $MyContent contain this litteral string:

{{box cssClass="floatinginfobox" title="**Sommaire**"}}

I noticed than I can't escaping some characters ({ and ") with  
$stringtool.contains

By example $stringtool.contains($MyContent,'box cssClass') working well but not 
$stringtool.contains($MyContent,'{box cssClass')

I tried to escape characters with \ and/or ~ without success :-(

Have you got an idea?



thanks

Pascal B
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to