dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: replace special characters

  1. #1
    ...in human form
    Join Date
    Aug 2002
    Posts
    188

    replace special characters

    Okay I've seen this before on here but the search on the new board blows. Server just overloaded or something. Anyway I need a function which I can use to replace all of the '& gt ;' in a string with the actual ' > ' symbol. My memory is failing me on how to script this type of function.
    Incarnations

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    What language are you using?

    In PHP you could do something like

    $myString = eregi_replace('>', '>', $myString);

    where $myString is the variable containing the > characters.

  3. #3
    they call me the_jump... le_saut's Avatar
    Join Date
    Mar 2001
    Posts
    536
    3 functions in PHP will help

    PHP and HTML
    1. htmlspecialchars()
    2. htmlentities()

    Will convert & to &, > to > etc etc

    PHP and Flash
    3. urlencode
    Will convert & to %26 etc

    Cheers
    James

  4. #4
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Assuming you do want to convert from > back to > using str_replace will probably be quicker than using the regular expression function I posted before,

    $myString = str_replace('>', '>', $myString);

  5. #5
    they call me the_jump... le_saut's Avatar
    Join Date
    Mar 2001
    Posts
    536
    aaah I should read the post from left to right instead of backwards. Now I get it...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center