转换""序列#""到" Serial#"

时间:2016-11-16 13:15:40

标签: javascript angularjs

我尝试过以下代码,但无法获得类似" Serial#"的结果。 其中column ="" Serial#"&#34 ;;

var b = column.replace(/ \"" / g,'"');

var b = column.replace(/"" / g,'"');

感谢

1 个答案:

答案 0 :(得分:0)

我假设字符串实际上是“串行”,而不是你想做的

protected override void OnApplyTemplate()
{
    if (header != null)
    {
        header.Tapped -= HeaderTapped;
    }

    base.OnApplyTemplate();

    VisualStateManager.GoToState(this, "Compact", true); //Go to compact state at first

    header = (ContentPresenter)GetTemplateChild("Header");
    header.Tapped += HeaderTapped;
}

public void Expand()
{
    VisualStateManager.GoToState(this, "Normal", true); //Go to Normal state firstly when it expanded, in order to make it visible.
    VisualStateManager.GoToState(this, "Expanded", true);
}

var column = "\"Serial #\"";  
var updated = column.replace(/^"|"$/g,""); //matches start of string followed by a quote or quote followed by end of the string

现在,如果字符串实际上是“串行”,那么你需要加倍引号。

var column = "\"Serial #\"";
var updated = column.replace(/"/g,""); //matches any quote

var column = '""Serial #""';
column.replace(/^"+|"+$/g,"")