cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: repalce function in Flowscript ?
Date Mon, 08 May 2006 13:35:03 GMT
Hi Luca,

Luca Morandini wrote:

> Hmmm... "replace" is a JavaScript function, not a Java one, hence I
> cannot understand how the string differences apply :(
>
> Anyway, I tried:
> var jfilters= new Packages.java.lang.String(filters);
> var re= new Packages.java.lang.String("/a/g");
> var s= new Packages.java.lang.String("b");
> jfilters.replace(re, b);

Nope, in this case you are not calling the javascript replace function,
which accept the /a/g syntax, but the java.lang.String.replace(char,
char) method, which only accept two chars.

How is the filter variable declared?

You could try one of the following :

var jsfilters = new String(filter);
var jsfilters = filters + '';

and then :

jsfilters.replace(/a/g,'b');

Hope this helps,

Simone

-- 
Simone Gianni

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message