Edit text

This is a discussion on Edit text within the Windows Programming forums, part of the Platform Specific Boards category; Good evening people. I have a CString variable that I need to "clean up" a little bit. Just to illustrate, ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    291

    Edit text

    Good evening people.

    I have a CString variable that I need to "clean up" a little bit.

    Just to illustrate, the variable make contain this text :
    Code:
        <td style="background-color: #fff9e4" valign="top" width="48%"> 
          <p>No more than two enhanced text links appear at the top of the Google 
            results page whenever the keywords or phrases you have purchased are searched 
            for by one of our users. <a href="overview.html">Learn more</a> or <a href="inquiry.html">contact 
            us today</a>.</p>
        </td>
        <td style="background-color: #ffffff" valign="top" width="4%">&nbsp;</td>
        <td style="background-color: #e6f2ea" valign="top" width="48%"> <p>Google 
            AdWords™ enables you to manage your own account, and with cost-per-click 
            (CPC) pricing, you pay only when users click on your ad. You control your 
            costs by setting a daily budget for what you are willing to spend each 
            day. Now available in 6 languages.</p>
          <p><a href="https://adwords.google.com/select/?hl=en">Get the details...</a>
    I want to remove all the tags and only have the actuall text left.
    The result should look something like this.

    Code:
    No more than two enhanced text links appear at the top of the 
    google results page whenever the keywords or phrases you
     have purchased are searched for by one of our users. Learn 
    more or contact us today Google AdWords™ enables you 
    to manage your own account, and with cost-per-click (CPC)
    pricing, you pay only when users click on your ad. You control
    your costs by setting a daily budget for what you are willing to 
    spend each day. Now available in 6 languages.
    Im obviously not expecting anyone to do this for me. Im just looking for some hints/tips on how approch this problem ?

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Read it one character at a time. Whenever you get a '<', start discarding the read characters until you get to the matching '>', then start copying the read characters to another buffer/string. Easy way - there are others.

    You'd need to be careful if you have embedded tags, but I doubt that would be the case.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need to edit text from within my application.
    By spiroth10 in forum C++ Programming
    Replies: 2
    Last Post: 12-15-2006, 03:15 PM
  2. Is Text Modified in Edit Control
    By anon in forum Windows Programming
    Replies: 1
    Last Post: 05-21-2006, 02:33 PM
  3. find if text in edit box has been changed
    By willc0de4food in forum Windows Programming
    Replies: 13
    Last Post: 09-10-2005, 11:47 PM
  4. Adding text to a disabled edit box
    By osal in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2004, 02:23 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21