snipt

Ctrl+h for KB shortcuts

ActionScript

xml new line problem solution

1
2
3
4
function fixXMLNewLines(str:String):String{
    var new_str:String = str.split("\\n").join("\n");
    return new_str;
}
https://snipt.net/embed/da4ebdadec6bb8c3ea2c980fd1244cf5/
/raw/da4ebdadec6bb8c3ea2c980fd1244cf5/
da4ebdadec6bb8c3ea2c980fd1244cf5
as
ActionScript
5
2019-08-23T20:21:29
True
False
False
/api/public/snipt/802/
xml-new-line-problem-solution
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">function</span> <span class="nx">fixXMLNewLines</span><span class="p">(</span><span class="nx">str</span><span class="o">:</span><span class="nb">String</span><span class="p">)</span><span class="o">:</span><span class="nb">String</span><span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">var</span> <span class="nx">new_str</span><span class="o">:</span><span class="nb">String</span> <span class="o">=</span> <span class="nx">str</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;\\n&quot;</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;\n&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">return</span> <span class="nx">new_str</span><span class="o">;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
as2, flash, newline, xml