如何替换livecode中的选定文本?

时间:2015-03-30 08:45:45

标签: livecode

我需要将选中的字符串替换为“sam”,该字符串由逗号(例如:sam,san)分隔,仅在选定的出现中。

on mouseUp
   put the selectedText of field "MytextField" into Ftext
   set the itemDel to comma
   put item 1 of Ftext into xsearch
   put item 2 of Ftext into xreplace
   replace the selectedText with xsearch  in field "MytextField"
end mouseUp

但它不起作用。

1 个答案:

答案 0 :(得分:0)

以下脚本将所需的字符串放入选择中,而不替换任何其他字符串:

on mouseUp
   put the selectedText of field "MytextField" into Ftext
   set the itemDel to comma
   put item 2 of fText into the selection
end mouseUp