×

Loading...

算了,再给你送一个trim

xanada (㊣流水)
function trim(str)
{
var i=0;

if(str.length==0) return '';

while(str.charAt(i) == ' ')
{
i++;
if (i==str.Length) return '';
}

var j=str.length-1;
while(str.charAt(j) == ' ')
{
j--;
if (j==0) return '';
}

if (i>j) return "";

return str.substring(i, j+1);
}
(#259436@0)
2001-11-12 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: 请教一个网页制作的问题。

Back To Forum: HOME枫下论坛枫下论坛主坛枫下家园电脑用户