我需要在开始{text}之前和结束{text}之后保留内容。如果我有两个按钮,名为" Preserve"和"恢复"。如果我单击“保留”按钮,则上面的整个文本开始{text},结束{text}后将复制到某个txt文件。我编辑后如果我点击"恢复"按钮保存的整个文件将在同一个地方过去。可能吗? 我正在使用此编码进行替换
put the htmlText of field "MytextField" into myHtml
set the caseSensitive to true
replace searchStr with "<strike><font bgcolor=" & quote & "yellow" & quote & ">" & searchStr & "</font></strike><font bgcolor=" & quote & "green" & quote & ">" & replaceStr & "</font>" in myHtml
set the htmlText of fld "MytextField" to myHtml
在开始{text}之前和结束{text}之后,我没有进行任何编辑。所以我可以节省时间和准确度
答案 0 :(得分:2)
可能你正在寻找这个:
put the htmlText of field "MytextField" into myHtml
put offset("begin{text}",myHtml) into startchar
put offset("end{text}",myHtml) into endchar
put char startchar to endchar of myHtml into text_to_preserve
put char 1 to (startchar - 1) into text_toEdit1
put char (endchar + 1) to -1 into text_toEdit2