jscript.net - Replace semicolon in Microsoft JSCRIPT -


I need to remove semicolon from the string in Microsoft JSCRIPT .

  var test = "{abcdef};"   

I have to remove the semi colon from the string test. But this is throwing a mess I ";" I have been using the following two methods to remove

  1) var reg = New RegExp (";", "g") var test = test.replace (reg, " ") 2) var test = test.replace (/; / g," ");   

> Your var test = "{abcdef};"

creates a new string variable test . To change its value and specify the result in 'one' variable,

  test = test.replace (reg, "")   

no

  var test = test.replace (reg, "")   

which is the test .

Evidence:

  JScript 10.0.30319% var t = "a; b; c;" One; B; % Var t = t.replace (/;, "") Error: Object required% var t = "a; b; c;" One; B; % T = t.replace (/; / g, "") ABC   

(This is the same result for JScript.NET 10.0.30319; WSH JScript 5.7.165 99) < / P>

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -