bjoern: Stringmethoden

Hallo Leute,

ich möchte in einem String <font color='#359228'>%2B</font> in ein "+"umwandeln.

Der Gesamte String lautet "news= Blabla1 <font color='#359228'>%2B</font><font color='#359228'>%2B</font><font color='#359228'>%2B</font> Blabla2 <font color='#359228'>%2B</font><font color='#359228'>%2B</font><font color='#359228'>%2B</font>".

Hierzu benutze ich "str_replace("<font color='#359228'>%2B</font>","+",$ticker);", was aber nicht funktioniert. Schätze liegt daran, dass die <font color='#359228'>%2B</font> Elemente ohne Leerzeichen direkt hintereinander folgen. Wie kann ich diese trotzdem umwandeln (möchte nicht alle drei + in einem str_replace() abarbeiten, weil es auch mal sein kann dass im String nur 1 oder 2 + hintereinander vorkommen.) Außerdem suche ich eine elegante Lösung den Stringanfang "news=" zu entfernen.

Wer kann helfen?

Dankeschön
bjoern

  1. Hallo bjoern.

    Hierzu benutze ich "str_replace("<font color='#359228'>%2B</font>","+",$ticker);", was aber nicht funktioniert.

    Funzt doch einwandfrei?

    <?php  
      
    $ticker = "news= Blabla1 <font color='#359228'>%2B</font><font color='#359228'>%2B</font><font color='#359228'>%2B</font> Blabla2 <font color='#359228'>%2B</font><font color='#359228'>%2B</font><font color='#359228'>%2B</font>";  
      
    $ticker = str_replace("<font color='#359228'>%2B</font>","+",$ticker);  
      
    echo $ticker;  
      
    ?>
    

    Einen schönen Donnerstag noch.

    Gruß, Ashura

    --
    Selfcode: sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:) fl:( ss:) ls:[ js:|
    30 Days to becoming an Opera8 Lover -- Day 21: Toolbars
    Meine Browser: Opera 8.01 | Firefox 1.0.6 | Lynx 2.8.5 | Netscape 4.7 | IE 6.0
    [Deshalb frei! - Argumente pro freie Software]