Difference between revisions of "RemoveHTMLTags"

From Second Life Wiki
Jump to navigation Jump to search
m (Missed commenting out one of the } brackets so the script wasn't compiling. Changed "}" to "// }")
Line 42: Line 42:
</lsl>
</lsl>


|caveats=none
|caveats=
*Text in hidden elements or elements that are not rendered will show up in the output text.
|examples=<lsl>
|examples=<lsl>
src = RemoveHTMLTags(src);
src = RemoveHTMLTags(src);

Revision as of 23:24, 23 March 2013

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 remove_HTML_tags(string source) {

   integer is_HTML = FALSE;
   string output;
   string characterInSource;
   integer index;
   do
   {
       characterInSource = llGetSubString(source, index, index);
       if (characterInSource == "<")

// {

           is_HTML = TRUE;

// }

       if (!is_HTML && characterInSource != "\n")

// {

           output += characterInSource;

// }

       if (characterInSource == ">")

// {

           is_HTML = FALSE;

// }

   }
   while (++index < llStringLength(source));
   return
       output;

} </lsl>

Caveats

  • Text in hidden elements or elements that are not rendered will show up in the output text.

Examples

<lsl> src = RemoveHTMLTags(src);

</lsl>