“JavaScript Remova vários vírgulas da string” Respostas de código

Remova vírgulas do javascript de string

var stringWithCommas = 'a,b,c,d';
var stringWithoutCommas = stringWithCommas.replace(/,/g, '');
console.log(stringWithoutCommas);
BluSilva

Remova vírgulas do javascript de string

var purpose = "I, Just, want, a, quick, answer!";

// Removing the first occurrence of a comma
var result = purpose.replace(",", "");

// Removing all the commas
var result = purpose.replace(/,/g, "");
Elegant Earthworm

JavaScript Remova vários vírgulas da string

/[,\s]+|[,\s]+/g

var str= "your string here";
//this will be new string after replace
str = str.replace(/[,\s]+|[,\s]+/g, 'your string here');
Borma

Respostas semelhantes a “JavaScript Remova vários vírgulas da string”

Perguntas semelhantes a “JavaScript Remova vários vírgulas da string”

Mais respostas relacionadas para “JavaScript Remova vários vírgulas da string” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código