Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 91231 invoked from network); 8 May 2006 13:33:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 May 2006 13:33:58 -0000 Received: (qmail 10081 invoked by uid 500); 8 May 2006 13:33:53 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 10035 invoked by uid 500); 8 May 2006 13:33:53 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 10024 invoked by uid 99); 8 May 2006 13:33:53 -0000 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [159.53.110.147] (HELO sj3.svr.bankone.net) (159.53.110.147) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 May 2006 06:33:53 -0700 Received: from si5.svr.bankone.net (si5.svr.bankone.net [155.180.56.117]) by sj3.svr.bankone.net (Switch-3.1.8/Switch-3.1.7) with ESMTP id k48EDwdh032685 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Mon, 8 May 2006 10:13:58 -0400 Received: from jpmchase.com ([10.246.2.155]) by si5.svr.bankone.net (Switch-3.1.8/Switch-3.1.7) with ESMTP id k48DWvte003845 for ; Mon, 8 May 2006 09:32:58 -0400 Received: from ([10.21.212.166]) by imb1.jpmchase.com with ESMTP id KP-BRCGX.17815704; Mon, 08 May 2006 09:32:07 -0400 In-Reply-To: Subject: Re: repalce function in Flowscript ? To: users@cocoon.apache.org X-Mailer: Lotus Notes Release 6.5.4 CCH5 September 12, 2005 Message-ID: From: ian.d.stewart@jpmchase.com Date: Mon, 8 May 2006 09:32:36 -0400 X-MIMETrack: Serialize by Router on MIUSMF007/JPMCHASE(Release 6.5.3|September 14, 2004) at 05/08/2006 09:32:39 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 cc: Sent by: news Subject: Re: repalce function in Flowscript ? 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: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org