<body onload="test()">
<script>
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
function test() {
var str = " a ";
alert("Original string: '" + str + "'");
str = str.trim();
alert("Incompletely stripped string: '" + str + "'");
}
</script>
No comments:
Post a Comment