Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
string replace function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
chris idr  
View profile  
 More options Jan 12, 7:17 am
Newsgroups: mozilla.dev.tech.js-engine.rhino
From: chris idr <ch...@idrsolutions.com>
Date: Mon, 12 Jan 2009 12:17:57 +0000
Local: Mon, Jan 12 2009 7:17 am
Subject: string replace function
Hi all,

can anyone tell me if rhino properly supports the replace function in
javascript, as i have an example and it doesn't seem to.

all it seems to do is redirect the call to java replace.

i have a replace(/,/gi,";");  (the g means replace all and the i means
ignore case)

can anyone tell me how to make this work properly, or when it might be
added.

if its not going to be added anytime soon, then could someone be kind
enough to tell me what to change in rhino itself so i can get it to
work, and i will submit my fix to you for inspection

regards
chris wade


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Norris Boyd  
View profile  
 More options Jan 12, 11:12 am
Newsgroups: mozilla.dev.tech.js-engine.rhino
From: Norris Boyd <norrisb...@gmail.com>
Date: Mon, 12 Jan 2009 08:12:31 -0800 (PST)
Local: Mon, Jan 12 2009 11:12 am
Subject: Re: string replace function
On Jan 12, 7:17 am, chris idr <ch...@idrsolutions.com> wrote:

The replace function is completely implemented as far as I know:

js> var s = "Hi, Mom";
js> s.replace(/m/gi, 'b');
Hi, bob

What isn't working for you?

--Norris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
chris idr  
View profile  
 More options Jan 12, 6:21 am
Newsgroups: mozilla.dev.tech.js-engine.rhino
From: chris idr <ch...@idrsolutions.com>
Date: Mon, 12 Jan 2009 11:21:25 +0000
Local: Mon, Jan 12 2009 6:21 am
Subject: string replace function
Hi all,

can anyone tell me if rhino properly supports the replace function in
javascript, as i have an example and it doesn't seem to.

all it seems to do is redirect the call to java replace.

i have a replace(/,/gi,";");  (the g means replace all and the i means
ignore case)

can anyone tell me how to make this work properly, or when it might be
added.

if its not going to be added anytime soon, then could someone be kind
enough to tell me what to change in rhino itself so i can get it to
work, and i will submit my fix to you for inspection

regards
chris wade


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Charles Lowell  
View profile  
 More options Jan 13, 8:10 am
Newsgroups: mozilla.dev.tech.js-engine.rhino
From: Charles Lowell <cowb...@thefrontside.net>
Date: Tue, 13 Jan 2009 05:10:12 -0800 (PST)
Local: Tues, Jan 13 2009 8:10 am
Subject: Re: string replace function
On Jan 12, 7:17 am, chris idr <ch...@idrsolutions.com> wrote:

Chris,

You have a reference to a java.lang.String. Try wrapping it in a
javascript string:

Rhino 1.7 release 1 2008 10 20
js> s = new java.lang.String("Hi Mom")
Hi Mom
js> s.replace(/m/gi,'b')
js: "<stdin>", line 3: The choice of Java constructor replace matching
JavaScript argument types (function,string) is ambiguous; candidate
constructors are:
    class java.lang.String replace(char,char)
    class java.lang.String replace
(java.lang.CharSequence,java.lang.CharSequence)
        at <stdin>:3

js> new String(s).replace(/m/gi,'b')
Hi bob
js>


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google