zoukankan      html  css  js  c++  java
  • JavaScript学习笔记

    • 寻找字符串是否存在

      对于JavaScript的indexOf忽略大小写 

      JavaScript中indexOf函数方法返回一个整数值,指出 String 对象内子字符串的开始位置。如果没有找到子字符串,则返回 -1。如果 startindex 是负数,则 startindex 被当作零。如果它比最大的字符位置索引还大,则它被当作最大的可能索引。 

      indexOf函数是从左向右执行查找。否则,该方法与 lastIndexOf 相同。 

      下面的示例说明了indexOf函数方法的用法

      function IndexDemo(str1,str2){ //判断字符是否被包含
      var s = str1.indexOf(str2);
      return(s);
      }
      
      我的调用方法:
      
      if (ret.status) {
      //api.alert({ msg: ret.wordStr });//消息弹窗
      if (IndexDemo(ret.wordStr,'开灯') != '-1' ) {
      iflyRecognition.stopRecord();//关闭录音
      iflyRecognition.hideRecordHUD()//隐藏录音图标
      write(dataPoint.GosDeviceWrite_on_off, true);
      tts('主人,灯已为您打开') 
      }
  • 相关阅读:
    Classic Source Code Collected
    Chapter 2 Build Caffe
    蓝屏代码大全 & 蓝屏全攻略
    AMD C1E SUPPORT
    DCU IP Prefether
    DCU Streamer Prefetcher
    adjacent cache line prefetch
    Hardware Prefetcher
    Execute Disable Bit
    Limit CPUID MAX
  • 原文地址:https://www.cnblogs.com/pengwenzheng/p/9395206.html
Copyright © 2011-2022 走看看