cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <>
Subject Re: repalce function in Flowscript ?
Date Mon, 08 May 2006 10:47:19 GMT
Hi Luca,
I think there is a misunderstanding between the fact that the "filters"
variable is a java.lang.String object, while you are trying to use it as
if it was a javascript string.

In flow (and in rhino generally) you can have a javascript string ( var
a = 'ciao';) or a java string ( var a = new'ciao') ). The method you can call on one or
another depends on the kind of string you are actually using.

I know this is a lot confusing, also because sometimes (eg. when the
string is used as a parameter) it is automatically converted from one
form to the other, while when calling a method on it it's not converted.

I actually know how to convert a javascript string to a java string (
var a = new; ) but not how to do the
opposite, maybe a simple var a = myjavastring + ''; could do the trick,
not sure about it.

Hope this helps,

Luca Morandini wrote:

> Alessandro Vincelli wrote:
>> Hi Luca,
>> the replace method accpet only java.lang.Character
>> from javadoc
>> String replace(char oldChar, char newChar)
>> you can try with
>> filters.replace("/a/g", "b");
> Been there, done that... no joy (same error message): It seems it
> chokes on the "/" (in other words: filters.replace("a", "b") works...
> but it's not what I want).
> I even tried building a RegExp... no way.
> Anyway, thanks for your help :)
> Regards,
> --------------------
>    Luca Morandini
> --------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Simone Gianni

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message