JavaScript string processing

xiaoxiao2021-03-06  104

Script language = "javascript">

Function JTRIM (STR)

{

VAR i = 0;

Var len = str.length;

IF (Str == ") Return (STR);

J = len -1;

Flagbegin = True;

Flagend = True;

While (Flagbegin == True && i

{

IF (Str.Charat (i) == "")

{

i = i 1;

Flagbegin = True;

}

Else

{

Flagbegin = false;

}

}

While (Flagend == True && J> = 0)

{

IF (str.Charat (j) == ""

{

J = J-1;

Flagend = True;

}

Else

{

Flagend = FALSE;

}

}

IF (i> j) Return ("")

Trimstr = Str.Substring (i, j 1);

Return Trimstr;

}

转载请注明原文地址:https://www.9cbs.com/read-103860.html

New Post(0)