#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    USA
    Posts
    67
    Rep Power
    15
    I am trying to translate the string

    word1%2Cword2 into word1,word2

    i used the code

    $str="word1%2Cword2";
    $str=~tr/%2C/,/;

    this yielded: word1,,,word2
    how can i fix this?

    thanks in advanced

  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    $str = "word1%2Cword2";
    $str =~ s/%2C/,/;
    # you probably wanna add this too..
    $str =~ tr/+/ /;
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    Try:

    $str=~s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;

    ------------------
    Dist - dist@clan-station.org - Founding member of Clan Station
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    USA
    Posts
    67
    Rep Power
    15
    thanks a lot freebsd & Dist, i appreciate your inputs, it has helped me solve my problem.

IMN logo majestic logo threadwatch logo seochat tools logo