removeHTMLTags

From Second Life Wiki
Jump to navigation Jump to search

Summary

Function: string RemoveHTMLTags( string input_string );

Returns a string with HTML ( or XML ) tags and newline characters removed.

• string input_string String to remove HTML tags from

See also: String

Specification

<lsl> string RemoveHTMLTags(string src) {

   integer is_HTML = 0;
   string result = "";
   string s;
   integer i;
   for (i=0; i<llStringLength(src); i++)
   {
     s = llGetSubString(src,i,i); 
     if (s == "<")
     {
           is_HTML = 1;
     }
     if (is_HTML == 0 && s != "\n")
       {
           result += s; 
       }
     if (s == ">")
       {
           is_HTML = 0;
       }
   }
   return result;

} </lsl>

Caveats

none

Examples

<lsl> src = RemoveHTMLTags(src);

</lsl>