반응형
<script>
function trim(str){
var count = str.length;
var len = count;
var st = 0;
while ((st < len) && (str.charAt(st) <= ' ')) {
st++;
}
while ((st < len) && (str.charAt(len - 1) <= ' ')) {
len--;
}
return ((st > 0) || (len < count)) ? str.substring(st, len) : str ;
}
</script>