xString = 'I have some double "e;quotes"e; in me like "e;this"e; :-)';
xLength = xString.length;
xIndex = 0; //Position in string
xCount = 0; //Odd or even (opening or closing)
while (xIndex < xLength) {
if (xString.indexOf('"e;')) {
xIndex = xString.indexOf('"e;')+1; //Position of first quote in string (+1)
xString = xString.substr(xIndex); //Cut string
xCount++;
} else {
xIndex = xLength;
}
}
alert(xCount);
I must have this all wrong. Never mind what I need it for (it's a small part of a function). It just crashes the browser. It should skip along the original string counting up each time it hits a double quote.
Thanks
Last edited by Chris Corbyn on Sat Apr 02, 2005 10:46 am, edited 1 time in total.
xString = 'I have some double "e;quotes"e; in me like "e;this"e; :-)';
xLength = xString.length;
xIndex = 0; //Position in string
xCount = 0; //Odd or even (opening or closing)
while (xIndex < xLength) {
if (xString.indexOf('"e;') != -1) {
xIndex = xString.indexOf('"e;')+1; //Position of first quote in string (+1)
xString = xString.substr(xIndex); //Cut string
xCount++;
} else {
xIndex = xLength;
}
}
alert(xCount);