Note also that if you need to go the Java route for some reason, the method
replaceAll(java.lang.String, java.lang.String) in java.lang.String works
similiarlly to the JavaScript replace method.

Example:

var javaFilters = new Packages.java.lang.String(filters);
var regexp = new Packages.java.lang.String("/a/");
var replace = new Packages.java.lang.String("b");

javaFilters.replaceAll(regexp, replace);


HTH,
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


                                                                                
                                                       
                      Simone Gianni                                             
                                                       
                      <[EMAIL PROTECTED]        To:       
[email protected]                                                       
                      it>                      cc:                              
                                                       
                                               Subject:  Re: repalce function 
in Flowscript ?                                          
                      05/08/2006 09:35                                          
                                                       
                      AM                                                        
                                                       
                      Please respond to                                         
                                                       
                      users                                                     
                                                       
                                                                                
                                                       




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: [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