It took two hours at night to use JavaScript to process a simple string filter function,CodePaste it to the following, which is actually very simple. You just want to filter out the <B/> in the query results returned by the Google Ajax search API.
A very important reason for spending so much time is that you are not familiar with JavaScript character join operations. JS does not support + =, so we need to use a = a + 'B'. In fact, it takes a lot of time to think about this problem and its simplicity.
function processstring (string) {<br/> var I = 0; <br/> var lefttagflag = false <br/> var clearstring = new string (); // No <B> tag string <br/> alert ("string. length = "+ String. length); <br/> while (I <string. length) {<br/> switch (string. charat (I) {<br/> case '<': lefttagflag = true; <br/> break; <br/> case '>': lefttagflag = false; <br/> break; <br/> case '/': <br/> case 'B': If (lefttagflag) <br/> break; <br/> else clearstring. concat (string. charat (I); <br/> default: clearstring = clearstring. concat (string. charat (I); <br/>}< br/> I ++; <br/>}