Difference between revisions of "RemoveHTMLTags"

From Second Life Wiki
Jump to navigation Jump to search
Line 2: Line 2:
|func=RemoveHTMLTags
|func=RemoveHTMLTags
|mode=user
|mode=user
|p1_type=string input_string
|p1_type=string|p1_name=input_string|p1_desc=String to remove HTML tags from
|return_type=string
|return_type=string
|return_text=input_string with HTML ( or XML ) tags and newline characters removed.
|return_text=input_string with HTML ( or XML ) tags and newline characters removed.

Revision as of 06:16, 5 July 2010

Summary

Function: string RemoveHTMLTags( string input_string );

Returns a string input_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>