Trim treatment - two sides (JavaScript)

xiaoxiao2021-03-06  52

Function GFTRIM (STRVALUE) {

Var intlen = strength;

VAR INTCNT;

For (intcnt = 0; INTCNT

IF (strValue.indexof (') == 0) {// full-corner space

Strvalue = strval .substring (1, intlen);

} else if (strValue.indexof (') == 0) {// half angle space

Strvalue = strval .substring (1, intlen);

Else if (Strvalue.indexOf (') == 0) {// Tab

Strvalue = strval .substring (1, intlen);

} else {

Break;

}

}

Intlen = Strvalue.Length;

For (intcnt = intlen; intcnt> 0; intcnt -) {

IF (strValue.lastindexof ('') == intcnt - 1) {// full-corner space

Strvalue = strValue.substring (0, INTCNT - 1);

} else if (strValue.lastIndexof ('') == INTCNT - 1) {// half angle space

Strvalue = strValue.substring (0, INTCNT - 1);

Else IF (Strvalue.lastIndexof ('') == INTCNT - 1) {// Tab

Strvalue = strValue.substring (0, INTCNT - 1);

} else {

Break;

}

Intlen = Strvalue.Length;

}

Return Strvalue;

}

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

New Post(0)