I'm writing a javascript calculator and need to replace the '^' character. Javascript does not seem to recognize this character correctly in a string.
var test="abc^d";
var searchstring="c"
alert(test.search(searchstring));
The above code correctly displays 2 when I change the c to ^, I get 0, not even -1. I get zero regardless of the position of ^. If I search for "c^" I get -1.
Any help is appreciated.
var test="abc^d";
var searchstring="c"
alert(test.search(searchstring));
The above code correctly displays 2 when I change the c to ^, I get 0, not even -1. I get zero regardless of the position of ^. If I search for "c^" I get -1.
Any help is appreciated.