如何比较两个滚动字段

时间:2015-04-21 06:48:20

标签: livecode

如何比较两个滚动字段(我有两个字段,一个包含一些文本,另一个包含搜索字符串&替换字符串,这些字符用冒号分隔。我想在第二个滚动中使用搜索字符串搜索第一个滚动字段中的每个单词字段,如果在第一个滚动字段中找到搜索字符串,则在第一个滚动字段中返回特定字词和搜索字符串计数。)

on mouseUp

   put  the fld  "MytextField" into myHtmll
   put the field SRText into myArrayT
   split myArrayT by CR
   put the number of lines of (the keys of myArrayT) into myArrayl
   repeat with j=1 to myArrayl
      put  myArrayT[j] into k 
      split k by colon
      put k[1] into searchStr1
      put k[2] into replaceStr1
   end repeat

   repeat for each word  dd in field "MytextField"
      if dd contains searchStr1 then
         --put Wordss after mm
         --answer searchStr1
         answer ok
      end if
      answer searchStr
   end repeat

end mouseU

这里" MytextField"是第一个滚动字段 这里" SRText"是第二个滚动字段

1 个答案:

答案 0 :(得分:1)

   on mouseUp
   set the caseSensitive to true
   put the field SRText into myArrayT
   split myArrayT by CR
   put the number of lines of (the keys of myArrayT) into myArrayl
       put 0 into tmp
    repeat for each key j in myArrayT
      put  myArrayT[j] into k 
      split k by colon


      put k[1] into searchStr1
      put the field "MytextField" into sss
      repeat for each word ass in sss

         if ass contains  searchStr1 then
            add 1 to tmp
            put ass after sam




         end if
      end repeat

   end repeat
   answer sam
      answer tmp
end mouseUP