更改livecode中的问题(REplace issue in livecode)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
更改livecode中的问题(REplace issue in livecode)

如何克服与此相关的问题。 我需要在myHtml中将“snn”替换为“”&“sss”和“”。 它将用“sss”替换所有“snn”。 但它不会在行的开头(换行符,\ n)起作用。

How to overcome the issue relating this replaces. I need to replace " snn" with "" & " sss" & "" in myHtml. it will replace all " snn" with " sss". but it will not work in the begin of a line(newline, \n).

最满意答案

我们假设我们有以下数据

那个男人站在地板上 男人等

在字段1.我们可以使用以下语法替换任何出现the或者或space & the或linefeed & the

on mouseUp put word 1 to -1 of replaceText(space & fld 1,"[\n ][tT]he "," an ") end mouseUp

注意额外的前面空格,使用word 1 to -1再次删除。

不幸的是,这种语法用空格替换了换行符。 我不知道你是否想要这个。 如果没有,我建议使用两行,一行用于空格,一行用于换行。

on mouseUp put replaceText(space & fld 1,"[\n]([tT]he) ",cr & "an ") into myTempVar put word 1 to -1 of replaceText(myTempVar,"[ ]([tT]he) "," an ") end mouseUp

总是用“an”代替“the”对我来说似乎有点奇怪,但它确实是你所要求的。

Let's assume we have the following data

the man stands on the floor The man etc

in field 1. We can replace any occurrence of the or The or space & the or linefeed & the with an using the following syntax

on mouseUp put word 1 to -1 of replaceText(space & fld 1,"[\n ][tT]he "," an ") end mouseUp

Note the extra preceding space, which is removed again using word 1 to -1.

Unfortunately, this syntax replaces linefeeds with spaces. Id on't know if you want this. If not, I'd suggest using two lines, one for space and one for linefeed.

on mouseUp put replaceText(space & fld 1,"[\n]([tT]he) ",cr & "an ") into myTempVar put word 1 to -1 of replaceText(myTempVar,"[ ]([tT]he) "," an ") end mouseUp

It seems a little strange to me to always replace "the" with "an" but it does what you're asking for.

更多推荐

本文发布于:2023-04-12 20:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/7e3ee998100003423f1137ff296f4748.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:livecode   REplace   issue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!