ClarionX Updates

    follow me on Twitter

    Subscribe

    Enter your email address:

    Delivered by FeedBurner

    Blog powered by TypePad
    Member since 08/2006

    November 11, 2006

    Gone in less than a Second....

    How to strip HTML Tags from a String Buffer in Clarion is easy as pi....

    Ever needed to extract data from html or clean up you email reader....

    Move a sliding window over the string data; determining when we have found the start and end of a html tag and then cut...its really that easy...

    Example Stripping Code:

    stag# = False
    j# = 1
    LOOP i# = 1 TO LEN(CLIP(pMessage))
    IF pMessage[i#] = CHR(62) AND stag# = True THEN
    stag# = False
    ELSIF pMessage[i#] = CHR(60) AND stag# = False THEN
    stag# = True
    ELSE
    IF NOT stag# THEN OutMessage[j#] = pMessage[i#];j# += 1.
    END
    END

    CHR(62) is '<' tag and CHR(60) is '>' tag....everything inclusive and in between is html formating....there are a few exceptions like converting <br> to carriage return line feeds and &nbsp; and other encoded chars like &#13; etc.....

    But this is perfect for extracting data from http streams...Clarion is a very powerful tool when doing parsing work...

    Cheers...