... escapetool.xml is my new friend :-/
$stringtool.contains($MyContent,$escapetool.xml('{{box
cssClass="floatinginfobox" title="**Sommaire**"}}'))
________________________________
De : Pascal BASTIEN <pbasnews-xwiki(a)yahoo.fr>
À : XWiki Users <users(a)xwiki.org>
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/c…
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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users