gpt4 book ai didi

list - Applescript 和 "starts with"运算符

转载 作者:行者123 更新时间:2023-12-03 23:18:26 25 4
gpt4 key购买 nike

有没有办法检查(在 applescript 中)是否有列表(或 html 文本块)starts with任意数量的值。

示例(检查单个值)

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

除了我想传递多个值来检查 <p><h1><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

关于list - Applescript 和 "starts with"运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5925439/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com