Here's what I'm trying to do. Honestly, I'm not even sure where to start.
var text1 = 'ThE foX iS brown',
text2 = 'the fox is brown the fox is brown THE FOX IS BROWN',
index = text2.toLowerCase().indexOf(text1.toLowerCase()),
output = 'do something with substring?';
alert(index);
The "text2" should be changed to: ThE foX iS brown the fox is brown THE FOX IS BROWN
var text1 = 'ThE foX iS brown the FOX is BrO',
text2 = 'the fox is brown the fox is brown THE FOX IS BROWN',
index = text2.toLowerCase().indexOf(text1.toLowerCase()),
output = 'do something with substring?';
alert(index);
And in this case "text2" should be changed to: ThE foX iS brown the FOX is BrOwn THE FOX IS BROWN
I thought that maybe I should first try to find the "first" occurrence of the string "text1" within "text2" but it doesn't seem to work? And I thought after that I could use substring
? Or maybe there's even an easier way to do this? I'm not sure. Any help would be really appreciated. Thank you.