【问题标题】:how to get specific word out of sentence in UIAutomation?如何在 UIAutomation 中从句子中取出特定的单词?
【发布时间】:2012-10-10 14:39:02
【问题描述】:

如果我需要检查某个句子中是否存在某个特定单词,那么我应该在 javascript 中为 UIAutomation 使用什么语法/代码?

【问题讨论】:

    标签: ios instruments ios-ui-automation


    【解决方案1】:

    使用函数 indexOf():

    在字符串中搜索“欢迎”:

     var str="Hello world, welcome to the universe.";
     var n=str.indexOf("welcome"); 
    

    n 的结果将是:

    13

    如果要搜索的值不存在,此方法返回 -1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      • 1970-01-01
      • 2021-08-28
      • 2021-06-28
      • 1970-01-01
      相关资源
      最近更新 更多