Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #12063

Re: Replace all strings

From "J.R." <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Replace all strings
Date 2012-02-22 16:48 -0200
Organization Aioe.org NNTP Server
Message-ID <ji3d9u$l9r$1@speranza.aioe.org> (permalink)
References <f65a4c81-b021-4254-b8d3-725858e39f32@vh10g2000pbc.googlegroups.com>

Show all headers | View raw


On 22/02/2012 15:48, Archos wrote:
> How to replace all strings at the same time?
>
>>>> var a = "a,b,c,d";
>>>> a.toString().replace(",", "")
> "ab,c,d"

If I understood correctly, you want to replace all the commas in a 
variable with '', right? Then you might use a RegExp such as:

var a = "a,b,c,d";
a.replace(/,/g, '')

-- 
Joao Rodrigues (J.R.)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Replace all strings Archos <raul.san@sent.com> - 2012-02-22 09:48 -0800
  Re: Replace all strings "J.R." <groups_jr-1@yahoo.com.br> - 2012-02-22 16:48 -0200
    Re: Replace all strings Archos <raul.san@sent.com> - 2012-02-22 11:29 -0800
      Re: Replace all strings "J.R." <groups_jr-1@yahoo.com.br> - 2012-02-22 20:27 -0200
        Re: Replace all strings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 14:36 +0100
          Re: Replace all strings Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-23 05:55 -0800
            Re: Replace all strings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-23 15:12 +0100
    Re: Replace all strings "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-22 22:02 +0000
      Re: Replace all strings Gene Wirchenko <genew@ocis.net> - 2012-02-22 15:03 -0800

csiph-web