suppress word delimiter effect of quotes

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

suppress word delimiter effect of quotes

Post by jmburnod » Sun May 24, 2015 3:28 pm

Hi All,
I search the simplest way to suppress the word delimiter effect in a sentence with quote chars.
Word 3 of a fld it contains :
He said "Hello Dears"
is
"Hello Dears" (with quotes :D )

Best regards
Jean-Marc
https://alternatic.ch

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: suppress word delimiter effect of quotes

Post by Thierry » Sun May 24, 2015 3:34 pm

jmburnod wrote: I search the simplest way to suppress the word delimiter effect in a sentence with quote chars.
Word 3 of a fld it contains :
He said "Hello Dears"
is
"Hello Dears" (with quotes :D )
Bonjour Jean-Marc,

what about this?

Code: Select all

replace quote with empty in field 1
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: suppress word delimiter effect of quotes

Post by SparkOut » Sun May 24, 2015 4:07 pm

Since LC 7.0 you can use trueWord to determine a word as being separate if there are no alphabetic or numeric characters between the word breaks:

Code: Select all

   put ("He said" && quote & "hello dears" & quote && "to his friends") into tWords
   put the number of words of tWords into tNum
   put the number of trueWords of tWords into tTrueNum
   answer word 3 of tWords && "is the 3rd word of the" && tNum && "words in" && quote & tWords & quote
   answer trueWord 3 of tWords && "is the 3rd trueWord of the" && tTrueNum && "trueWords in" && quote & tWords & quote
However, this seems to have uncovered a bug on my installation (7.0.5 community edition, Windows 7) as both tNum and tTrueNum tell me the number of words or trueWords of tWords is 6, where it should be 7 trueWords.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: suppress word delimiter effect of quotes

Post by FourthWorld » Sun May 24, 2015 4:11 pm

V7 introduced the trueWord token for that.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn


Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: suppress word delimiter effect of quotes

Post by Thierry » Sun May 24, 2015 5:07 pm

SparkOut wrote:Since LC 7.0 you can use trueWord ......
Using your sample code, here is how it will work for *all* versions of LiveCode,
especially before LC 7.

Code: Select all

put ("He said" && quote & "hello dears" & quote && "to his friends") into tWords
replace quote with empty in tWords
put the number of words of tWords into tNum
answer word 3 of tWords && "is the 3rd word of the" && tNum && "words in" && quote & tWords & quote
Hope this clarifies my 1st post.

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: suppress word delimiter effect of quotes

Post by jmburnod » Tue May 26, 2015 9:51 am

Hi All,
Thanks at all
Yes Thierry i used a replace script but I need show quote chars.
I work around this way. I will write back about it
Jean-Marc
https://alternatic.ch

Post Reply