base:StripHTML()

You can post your code snippets here for others to use and learn from

base:StripHTML()

Postby djrikki » Wed Apr 15, 2015 11:50 pm

Code: Select all
Global base
base = {}

;; base:StripHTML(line$)
; Convert a string containing HTML codes into regular text
; Please note this is not an exhaustive list of character codes.  Add more as required.
Function base:StripHTML(data$)

    data$ = base:FindAndReplace(data$," "," ")
    data$ = ReplaceStr(data$,"!","!")
    data$ = ReplaceStr(data$,""","\"")
    data$ = ReplaceStr(data$,"#","#")
    data$ = ReplaceStr(data$,"$","$")
    data$ = ReplaceStr(data$,"%","%")
    data$ = ReplaceStr(data$,"&","&")
    data$ = ReplaceStr(data$,"'","'")
    data$ = ReplaceStr(data$,"(","[")
    data$ = ReplaceStr(data$,")","]")
    data$ = ReplaceStr(data$,"*","*")
    data$ = ReplaceStr(data$,"+","+")
    data$ = ReplaceStr(data$,",",",")
    data$ = ReplaceStr(data$,"-","-")
    data$ = ReplaceStr(data$,".",".")
    data$ = ReplaceStr(data$,"/","/")
    data$ = ReplaceStr(data$,"0","0")
    data$ = ReplaceStr(data$,"1","1")
    data$ = ReplaceStr(data$,"2","2")
    data$ = ReplaceStr(data$,"3","3")
    data$ = ReplaceStr(data$,"4","4")
    data$ = ReplaceStr(data$,"5","5")
    data$ = ReplaceStr(data$,"6","6")
    data$ = ReplaceStr(data$,"7","7")
    data$ = ReplaceStr(data$,"8","8")
    data$ = ReplaceStr(data$,"9","9")
    data$ = ReplaceStr(data$,":",":")
    data$ = ReplaceStr(data$,"&#59;",";")
    data$ = ReplaceStr(data$,"&#60;","<")
    data$ = ReplaceStr(data$,"&#61;","=")
    data$ = ReplaceStr(data$,"&#62;",">")
    data$ = ReplaceStr(data$,"&#63;","?")
    data$ = ReplaceStr(data$,"&#64;","@")
    data$ = ReplaceStr(data$,"&#91;","[")
    data$ = ReplaceStr(data$,"&#92;","\\")
    data$ = ReplaceStr(data$,"&#93;","]")
    data$ = ReplaceStr(data$,"&#94;","^")
    data$ = ReplaceStr(data$,"&#95;","_")
    data$ = ReplaceStr(data$,"&#96;","^")
    data$ = ReplaceStr(data$,"&#123;","{")
    data$ = ReplaceStr(data$,"&#124;","|")
    data$ = ReplaceStr(data$,"&#125;","}")
    data$ = ReplaceStr(data$,"&#126;","~")
    data$ = ReplaceStr(data$,"&#160;"," ")
    data$ = ReplaceStr(data$,"&#163;","£")
    data$ = ReplaceStr(data$,"&#169;","©")
    data$ = ReplaceStr(data$,"&#174;","®")
    data$ = ReplaceStr(data$,"&#176;","°")
    data$ = ReplaceStr(data$,"&quot;","\"")
    data$ = ReplaceStr(data$,"&amp;","&")
    data$ = ReplaceStr(data$,"&lt;","<")
    data$ = ReplaceStr(data$,"&rt;",">")
    data$ = ReplaceStr(data$,"&nbsp;"," ")
    data$ = ReplaceStr(data$,"&pound;","£")
    data$ = ReplaceStr(data$,"&copy;","©")
    data$ = ReplaceStr(data$,"&reg;","®")
   
    Return(data$)
EndFunction
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
 
Posts: 645
Joined: Wed Apr 06, 2011 12:26 am

Return to Code snippets area

Who is online

Users browsing this forum: No registered users and 1 guest