Prototype: Strings
<script>
document.observe('dom:loaded', function() {
// Stripping:
var text = $('text').innerHTML;
$('output').insert(text.stripTags() + '<br />');
// Escaping:
var html = "<p>Here is some <b>Text</b></p>";
$('output').insert(html.escapeHTML() + '<br />');
// Parsing:
var query = "?name=Jesse&age=26&hobbies=plenty";
var obj = query.parseQuery();
$('output').insert(Object.inspect(obj) + '<br />');
// Parse Object into readable Hash:
var hash = $H(obj);
alert(Object.inspect(hash));
// Inspecting:
var string = "Aren't we going to the store today? \n Jesse's gas is low!";
$('output').insert(string.inspect());
});
</script>
<p id="text">
This is some text with <b>html</b> and I hope it <br /> looks good.
</p>
<div id="output"></div>