Page 1 of 1
suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 3:28 pm
by jmburnod
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

)
Best regards
Jean-Marc
Re: suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 3:34 pm
by Thierry
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

)
Bonjour Jean-Marc,
what about this?
Code: Select all
replace quote with empty in field 1
Thierry
Re: suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 4:07 pm
by SparkOut
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.
Re: suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 4:11 pm
by FourthWorld
V7 introduced the trueWord token for that.
Re: suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 4:23 pm
by SparkOut
Re: suppress word delimiter effect of quotes
Posted: Sun May 24, 2015 5:07 pm
by Thierry
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
Re: suppress word delimiter effect of quotes
Posted: Tue May 26, 2015 9:51 am
by jmburnod
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