var shortLocString = locationString;
console.log("Index of dash in '" + shortLocString + "': " + shortLocString.indexOf('-'));
打印每次都是这样:的indexOf(“ - ”)回归 - 每次1
Index of dash in '325–333 Avenue C, New York, NY': -1
为什么我觉得这是我的思念在漫长的一天结束了一些愚蠢的事?
感谢您的帮助!
Mike
'-'是没有找到,因为你有一个'-','' - '!=='-'' –
你得到了字符'0x96'并检查字符'0x2D' – snwflk
它是http://www.fileformat.info/info/unicode /char/2013/index.htm – zerkms