I'm guessing that you're running into issues with the replace(char, char)
method from java.lang.String.

Have you tried doing this in native JavaScript (e.g., filters.replace(/a/g,
'b')) ?


Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                
                                                       
                      Luca Morandini                                            
                                                       
                      <[EMAIL PROTECTED]        To:       
[email protected]                                                       
                      org>                     cc:                              
                                                       
                      Sent by: news            Subject:  Re: repalce function 
in Flowscript ?                                          
                      <[EMAIL PROTECTED]                                        
                                                        
                      rg>                                                       
                                                       
                                                                                
                                                       
                                                                                
                                                       
                      05/08/2006 08:56                                          
                                                       
                      AM                                                        
                                                       
                      Please respond to                                         
                                                       
                      users                                                     
                                                       
                                                                                
                                                       




Simone Gianni wrote:
> 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
> Packages.java.lang.String('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 Packages.java.lang.String(jsstring); ) but not how to do the
> opposite, maybe a simple var a = myjavastring + ''; could do the trick,
> not sure about it.
>
> Hope this helps,

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);

to no avail:
...line 249: Cannot convert /a/g to java.lang.Character

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to