Substitute "|" for " "

I have a dynamic text and in it I pull a value that I places in the PARAM of my HTML, like this, " …&p1=de|R$+9,49|por|R$+799,58 ", I am trying to make the following one, show the value in the dynamic text, " R$+799,58 “, without the “de” or “|” or “por”, I already tried to make this.
[AS]
var valorDe:String = “!”;
var valorPosicao:Number = _root.p1.text.indexOf (valorDe);
if (valorPosicao >=0) {
_root.p1.removeTextField (0, valorPosicao, " “);
}[/AS]
and this
[AS]
if (p1.indexOf (”|”) >= 0) {
p1 = ‘’;
}
[/AS]
but nothing works.

Sorry about my English