Difference between revisions of "RemoveHTMLTags"
Jump to navigation
Jump to search
Kireji Haiku (talk | contribs) m |
|||
Line 8: | Line 8: | ||
See also: [[String]] | See also: [[String]] | ||
|spec=<lsl> | |spec=<lsl> | ||
string | string remove_HTML_tags(string source) | ||
{ | { | ||
integer is_HTML = | integer is_HTML = FALSE; | ||
string | |||
string | string output; | ||
integer | string characterInSource; | ||
integer index; | |||
do | |||
{ | { | ||
characterInSource = llGetSubString(source, index, index); | |||
if (characterInSource == "<") | |||
is_HTML = | // { | ||
is_HTML = TRUE; | |||
// } | |||
if (!is_HTML && characterInSource != "\n") | |||
// { | |||
output += characterInSource; | |||
} | } | ||
if (characterInSource == ">") | |||
// { | |||
is_HTML = FALSE; | |||
// } | |||
} | } | ||
return | while (++index < llStringLength(source)); | ||
return | |||
output; | |||
} | } | ||
</lsl> | </lsl> |
Revision as of 15:26, 29 October 2012
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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
none
Examples
<lsl> src = RemoveHTMLTags(src);
</lsl>