本文介绍了Applescript 和“开始于"操作员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检查(在applescript中)列表(或html文本块)是否以任意数量的值开头.

Is there a way to check (in applescript) if a list (or block of html text) starts with any number of values.

示例(检查单个值)

if {foobar starts with "<p>"} then
    -- do something awesome here
end if

除非我想传递多个值来检查

.

except i would like to pass multiple values to check <p> or <h1> or <em>.

提前致谢.

推荐答案

on startswith(txt, l)
    repeat with v in l
        if txt starts with v then return true
    end repeat
    false
end startswith

startswith("abc", {"a", "d", "e"}) -- true

这篇关于Applescript 和“开始于"操作员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 04:59