2015-04-17 36 views
0

我想查看替換正在發生的特定行。所有其他文字應以隱藏格式顯示。可能嗎?如何隱藏livecode中的特定文本

on mouseUp 
    put the htmlText of field "MytextField" into myHtml 
    set the caseSensitive to true 
    put the field SRText into myArrayToBe 
    split myArrayToBe by CR 
    put the number of lines of (the keys of myArrayToBe) into myArraylength 
    repeat with i = 1 to myArraylength 
     --return i 
     put myArrayToBe[i] into y 
     split y by colon 
     put y[1] into searchStr 
     put y[2] into replaceStr 
     if searchStr is empty then 
     put the 0 into m 
     else 
     replace searchStr with "<strike><font bgcolor=" & quote & "yellow" & quote & ">" & searchStr & "</font></strike><font bgcolor=" & quote & "green" & quote & ">" & replaceStr & "</font>" in myHtml 
     end if 
    end repeat 
    set the htmlText of fld "MytextField" to myHtml 
    end mouseUP 
+0

你是否像誰一直在發佈大量的問題一樣使用數組的語法?真的,你不需要使用數組。請停止使用數組。 – Mark

回答

0

我不完全清楚你想要做什麼,但我認爲你不想先'替換'。將myHtml轉儲到「MytextField」中,然後在該字段中使用查找語法。它會滾動到找到的文本並圍繞它繪製一個方形,然後您可以使用foundtext,foundline,foundchunk替換,突出顯示,調暗所有其他文本或任何後續內容。