indexOf()方法返回某个指定的字符串值在字符串中首次出现的位置。

stringObject.indexOf(searchvalue,fromindex);
indexOf()方法对大小写敏感
如果要检索的字符串值没有出现,则返回-1
 <script>
var str="11Hello world!";
document.write(str.indexOf("Hello")+"<br />");
document.write(str.indexOf("Hello",3)+"<br />");
document.write(str.indexOf("World")+"<br />");
document.write(str.indexOf("world")+"<br />");
</script>

w3c官方文档http://www.w3school.com.cn/jsref/jsref_indexOf.asp

最新文章

  1. 年度巨献-WPF项目开发过程中WPF小知识点汇总(原创+摘抄)
  2. CSharpGL(1)从最简单的例子开始使用CSharpGL
  3. cosbench 异常 FreeMarker template error: The following has evaluated to null or missing
  4. 【译】Activitys, Threads和 内存泄露
  5. c coding style之学习篇
  6. 在windows命令行窗口下执行:查看所有的端口占用情况
  7. 20170510 mysql导入导出csv
  8. 计蒜客NOIP模拟赛(2) D1T1邻家男孩
  9. 编写程序,将来自文件中的行保存在一个vector&lt;string&gt;,然后使用一个istringstream 从vector中读取数据,每次读一个单词
  10. 五子棋棋盘布局 table和ul哪个好
  11. linux 6.5上创建新用户后,不能登陆?
  12. C#异步编程の----Threadpool( 线程池)
  13. Stateful Kubernetes Applications Made Easier: PSO and FlashBlade
  14. ReactCSSTransitionGroup
  15. 线特征---LineMatching原理(四)
  16. BugkuCTF ---游戏过关 writeup
  17. WinForm多线程实现HTTP网络检测工具
  18. python基础之字符串格式化
  19. [Android开发那点破事]解决android.os.NetworkOnMainThreadException
  20. #leetcode刷题之路47-全排列 II

热门文章

  1. php图片上面写文字,输出图片
  2. windows快捷键命令汇总整理
  3. OD: Big_Endian vs Little_Endian
  4. 打开新窗口(window.open)
  5. IE浏览器下a标签嵌套img标签默认带有边框
  6. js获取当前的时间(包含星期)
  7. oracle获得每周,每月,每季度,每年的第一天
  8. Swift--基础(一)基本类型 符号 字符串(不熟的地方)
  9. c++回调实现
  10. css3中的提供的元素变化属性