Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing 1

Status
Not open for further replies.

Ablecken

Programmer
Jun 5, 2001
130
US
if i had a string that was user inputed how would i go through the string and take out all spaces?
 
You`d better do this by JavaScript.

function operation(temp,add,out) {
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
return temp;
}

function keepsearching(texthere) {
out = " "; // replace this
add = ""; // with this
temp = "" + texthere; // temporary holder

temp=operation(temp,add,out);
return temp;

}

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top