If statement 打字稿中的strpos。在绳子里找到一根针
打字稿中有类似于strpos的东西吗 我想在另一个字符串中找到一个字符串。如果找到字符串,则应显示COAIf statement 打字稿中的strpos。在绳子里找到一根针,if-statement,typo3,typoscript,If Statement,Typo3,Typoscript,打字稿中有类似于strpos的东西吗 我想在另一个字符串中找到一个字符串。如果找到字符串,则应显示COA site.10 = COA site.10 { stdWrap.if.isTrue stdWrap.if.?? } 我不知道如何解决这个问题。好吧,没有任何内置内容可以直接用于打字脚本。但是你可以为自己打造一个小帮手,做同样的事情 示例 # fn.isInString will return true, if the needle was found in string fn.
site.10 = COA
site.10 {
stdWrap.if.isTrue
stdWrap.if.??
}
我不知道如何解决这个问题。好吧,没有任何内置内容可以直接用于打字脚本。但是你可以为自己打造一个小帮手,做同样的事情 示例
# fn.isInString will return true, if the needle was found in string
fn.isInString = COA
fn.isInString {
1 = LOAD_REGISTER
1 {
# REGISTER for what you are looking for
needle =
# REGISTER
haystack =
# split haystack by the needle
# result is a haystack without a needle, if found
findNeedleInHaystack.cObject = TEXT
findNeedleInHaystack.cObject {
data = REGISTER:haystack
split.token.data = REGISTER:needle
}
}
# compare REGISTER:haystack and result of REGISTER:findNeedleInHaystack
# if both are the same, nothing was found
10 = TEXT
10 {
# true will be returned, if the needle was found inside haystack
value = true
if {
value.data = REGISTER:haystack
equals.data = REGISTER:findNeedleInHaystack
negate = 1
}
}
}
# working example
site = PAGE
site {
10 = COA
10 {
10 = TEXT
10.value = Your content will apear, if the needle was found in the haystack! :O
stdWrap.if.isTrue.cObject < fn.isInString
stdWrap.if.isTrue.cObject.1 {
needle = needle
haystack = needle in the haystack
}
}
}
如果在字符串中找到指针,则fn.isInstalling将返回true
fn.i安装=COA
fn.i安装{
1=加载寄存器
1 {
#注册你要找的东西
针=
#登记册
干草堆=
#用针劈开干草堆
#如果找到了,结果就是一个没有针的干草堆
findNeedleInHaystack.cObject=TEXT
findNeedleInHaystack.cObject{
数据=寄存器:haystack
split.token.data=寄存器:指针
}
}
#比较寄存器:haystack和寄存器结果:findNeedleInHaystack
#如果两者相同,则未找到任何内容
10=文本
10 {
#如果在干草堆内发现针,则返回true
值=真
如果{
value.data=寄存器:haystack
equals.data=寄存器:findNeedleInHaystack
否定=1
}
}
}
#工作示例
站点=第页
场地{
10=COA
10 {
10=文本
10.value=如果在干草堆中发现了针,则您的内容将消失!:O
stdWrap.if.isTrue.cObject- 您可以使用适合您需要的东西扩展stdWrap.if
- 您可以在php中使用带有strps功能的UserFunc