How to remove comma from the string in javascript?

Today, We want to share with you remove comma from string javascript.In this post we will show you How to Remove Commas from Array in JavaScript, hear for remove first and last comma from string in javascript? we will give you demo and example for implement.In this post, we will learn about delete comma from number js with an example.

How to remove comma from string in jquery/javaScript with example ?

Sometimes, we require to remove comma, semicolon, colon etc from string in your jquery code At that time you can simply remove comma using js replace(). Jquery replace() through we can replace comma into empty string that way comma will be remove from jquery string.

remove text after a comma

var strDataVal = 'Welcome To Pakainfo,com, My Long Love live in Rajkot';
console.log("The original value="+strDataVal);
var expression = strDataVal.match(/([^,]*)(.*)/)[1];
var positionForComma = strDataVal.match(/([^,]*),(.*)/)[2].split(' ')[1]
var resData = expression + ', ' + positionForComma
console.log("Updated="+resData);

JavaScript Regex To Remove Commas From A String

function DeleteComma(MyString)
{

var objRegex = '/,/g';

//Replace Commas By Null....
return MyString.replace(objRegex,'');
}

Remove Last Comma from String in jQuery

Example 3: index.html




  Remove last comma from string jquery - www.pakainfo.com
  
  
  


  

index.html




  Jquery remove comma from string - www.pakainfo.com
  







I hope you get an idea about delete all comma from string javascript.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment