Difference between revisions of "RemoveHTMLTags"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'string RemoveHTMLTags(string src) { integer is_HTML = 0; string result = ""; string s; integer i; for (i=0; i<llStringLength(src); i++) { s = llGetS...')
 
Line 1: Line 1:
{{LSL_Function
|func=RemoveHTMLTags
|mode=user
|p1_type=string input_string
|return_type=string
|return_text=input_string with HTML ( or XML ) tags and newline characters removed.
|func_footnote=
See also: [[String]]
|spec=<lsl>
string RemoveHTMLTags(string src)
string RemoveHTMLTags(string src)
{
{
Line 23: Line 32:
     return result;
     return result;
}
}
</lsl>
|caveats=none
|examples=<lsl>
src = RemoveHTMLTags(src);
</lsl>
|helpers
|notes
|also
|also_functions
|also_articles
|cat1=User-Defined_Functions
|cat2=Examples
|cat3
|cat4
}}

Revision as of 06:12, 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

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>