1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Removing/substituting words in a string HELP!

Discussion in 'C' started by sg57, Mar 7, 2006.

  1. sg57

    sg57 New Member

    Joined:
    Mar 7, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to make a small AIM app, so far I can connect to the internet and get IMs, not send yet, but get. Now, when recieving, I get the message in HTML coding, I want to for now remove those words:

    Code:
    <HTML><FONT>Hey</FONT></HTML>
    Now, what string manipulative can I use to remove the words/HTML coding? Is it like a strmove function that will move the words to another buffer I do not want to display? Please help as this is a somewhat AIM client for hte PSP. I am using just C, unless C and C++ will co operate together? I dunno, I just need an answer to my question, thanks.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    First of all welcome to www.go4expert.com

    This can be done by just parsing the character array that contains the output. Search for < and move from the next character till the > if you find matching < and > remove discard the string.
     
  3. sg57

    sg57 New Member

    Joined:
    Mar 7, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Hmmmm... Ok, parsing, thanks, I had heard that somewhere, but never had thought to use it, thanks for the answer and how quick it was. Now I can simply use a token to remove un-useable characters. An example is machine code that is generated by the Null (0x00) character. This also can be used for 'smilies' I assume? Simply instead of removing the certain 'characters' just replace them with an image, simple.

    Thanks, Ill be sure to refer this site to some other developers in need of some help! :eek:
     
    Last edited: Mar 7, 2006
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Yeah. Replacing them with NULL is also not a bad option.
     
  5. sg57

    sg57 New Member

    Joined:
    Mar 7, 2006
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    That might be better actually, use a prototype (change whatever words I want to the Null character) then use that strtok function/prototype to remove all Null characters. Just need to parse the string characters all together, then proceeed.
     
  6. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    734
    Likes Received:
    37
    Trophy Points:
    0
    Actually I agree.
     

Share This Page