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
-
pderks
- Posts: 58
- Joined: Sat May 14, 2011 4:25 pm
- Location: Krefeld • Deutschland
Post
by pderks » Mon Jun 10, 2019 5:47 pm
Hi,
Code: Select all
put ""
put "AA" & NumToCodepoint(160) & "BB" into XX
put "1" & tab & XX & tab & "Segments" & tab & the Num of segments of XX & cr after msg
put "1" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after msg
put "1" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after msg
put "AA" & NumToChar(202) & "BB" into XX -- nbsp MacRoman
put "2" & tab & XX & tab & "Segments" & tab & the Num of segments of XX & cr after msg
put "2" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after msg
put "2" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after msg
If I type "AA" and an option-space and "BB" I get again 2 words instead of only one.
Is that an achievement of of LC 9.0.4 ?
Peter
Mac Pro 2012 · macOS 10.12.6 · LC 9.0.4 CE
-
Klaus
- Posts: 13829
- Joined: Sat Apr 08, 2006 8:41 am
- Location: Germany
-
Contact:
Post
by Klaus » Mon Jun 10, 2019 6:20 pm
Hi Peter,
no idea if this is new in 9.0.4, but it works as expected, the AA BB will WRAP as if it is ONE word.
However LC does treat them as two words.
This is the definition of a word in LC, anything separated by a SPACE, comma etc. and LC does obviously treat a non-breaking space as a space resp. does not differ them
Not sure if this is a bug or a feature!?
Best
Klaus
-
pderks
- Posts: 58
- Joined: Sat May 14, 2011 4:25 pm
- Location: Krefeld • Deutschland
Post
by pderks » Mon Jun 10, 2019 6:35 pm
Hi, Klaus,
it is a bug in LC 9.0.4.
I just typed into the msg box of LC 5.0.5 Build 1503:
Code: Select all
put "AA BB" into XX; put num of words in XX
and got "1".
Bester
Peter
-
dunbarx
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Post
by dunbarx » Mon Jun 10, 2019 7:01 pm
I am usually behind the times with all these new-fangled chunk options in the most recent versions, but anything enclosed in quotes was always one word.
The "trueWord" keyword seems to be the ticket here. It uses the ICU library, not LiveCodes own peccadilloes, as the delimiter between those two strings.
Craig
-
Klaus
- Posts: 13829
- Joined: Sat Apr 08, 2006 8:41 am
- Location: Germany
-
Contact:
Post
by Klaus » Mon Jun 10, 2019 7:08 pm
Hi Craig,
true, but the content of the variable XX does NOT contain the QUOTES!
Just tested in 5.02 with this script, had to comment out lines with NumToCodepoint and SEGMENT:
Code: Select all
on mouseUp
put "" into fld 1
put "AA BB" into XX
put "1" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after fld 1
put "1" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after fld 1
put "AA" & NumToChar(202) & "BB" into XX -- nbsp MacRoman
put "2" & tab & XX & tab & "Words" & tab & the Num of words of XX & cr after fld 1
put "2" & tab & XX & tab & "Chars" & tab & the Num of chars of XX & cr after fld 1
end mouseUp
And got:
1 AA BB Words 1
1 AA BB Chars 5
2 AA BB Words 1
2 AA BB Chars 5
So this is definitively a bug.
@Peter
Did you already report this?
Best
Klaus
-
pderks
- Posts: 58
- Joined: Sat May 14, 2011 4:25 pm
- Location: Krefeld • Deutschland
Post
by pderks » Mon Jun 10, 2019 7:37 pm
Klaus, I did …
-
dunbarx
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Post
by dunbarx » Mon Jun 10, 2019 7:41 pm
true, but the content of the variable XX does NOT contain the QUOTES!
True. I was thinking theoretically, not, you know, in any useful way.
Craig
-
sphere
- Posts: 1145
- Joined: Sat Sep 27, 2014 10:32 am
- Location: Earth, Except when i Jump
Post
by sphere » Tue Jun 11, 2019 1:51 pm
Seems to work correct in LC950dp1
the lower button does what you describe
edit: and this
put "AA BB" into XX; put num of words in XX
gives 2 in the messagebox
or am i misunderstanding you?