I have to make a function that finds when "www." Appears in a string, for example "Hey dude, check this thing: www.example.com/". I want it to determine when the url starts(in this case it would be the 28th character in the string). I tried this:
var wwwPos = new Number;
function findURL(message){
splitStr = message.split ("");
for(var i = 0; i <splitStr.length; i++){
if(splitStr[i] == "w" && splitStr[i+1] == "w" && splitStr[i+2] == "w" && splitStr[i+3] == "."){
wwwPos=i
break;
}
}
}
But it didn't work...