(JS) Javascript Function Remove Slash From String

JavaScript Function
All I needed was to expel every single forward slice in a string utilizing Javascript.
Remove Forward Slash (/) Using JavaScript Function
function FSlash(func){
var x = func,
    n = x.replace(/\//g,'');
return n
  }
//Usage Using Variable
var nx = "4x/4/4/5/6/7//532///45/";
//Call Variable Into Function Name
    document.write(FSlash(nx));
//You can combine from function too
Demo : CodePen
The vital part to note here is the consistent articulation /\//g. The bit of the string you need supplanting is composed between the first and last forward cuts – so on the off chance that you needed the word 'work area' supplanted you would compose/work area/g.

As the character we need to expel is an uncommon case you need to escape it utilizing an oblique punctuation line, generally the code will read the twofold forward cut as a remark thus quit preparing the line.

At last, the g implies apply the substitution internationally to the string with the goal that all occasions of the substring are supplanted.
Remove Back Slash (\) Using JavaScript Function
function BSlash(func){
var x = func,
    n = x.replace(/\\/g, '')
return n
  }
//Usage Using Variable
var nx = "Dev : \D\i\m\a\s\Www.webmanajemen.xyz";
//Call Variable Into Function Name
    document.write(BSlash(nx));
//You can combine from function too
Demo : JsFiddle
so an article about "JS Function Remove Slash From String" today. I hope this helps.
Facebook CommentsShowHide

0 komentar

Bila Ada posting yang kurang, atau error atau yang lainnya, silahkan tinggalkan komentar agar artikel/post di perbaiki.
Jangan Lupa Cek Box "Notify Me" agar tahu komentar kamu dibalas oleh saya.

If there are any posts that are missing, or error or anything else, please leave a comment for the article / post to be fixed.
Do not Forget Check Box "Notify Me" to know our comments replied by me.