problem trueword in a string with "."not followed by a spac
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
problem trueword in a string with "."not followed by a spac
Hi All,
I noticed a problem about trueword in a string with "." when "." is not followed by a space.
put trueword 5 of "Cooking with livecode is nice.Verry Nice" return "nice.Verry" and I expected "nice".
Same result with ":" but works fine with "!?,;-".
Is it a bug or i missed something in the doc ?
"A trueWord is a word chunk, delimited by Unicode word breaks, as determined by the ICU Library. When there are no alphabetic or numeric characters between two word breaks, that string is not considered by LiveCode to be a trueWord."
Best regards
Jean-Marc
I noticed a problem about trueword in a string with "." when "." is not followed by a space.
put trueword 5 of "Cooking with livecode is nice.Verry Nice" return "nice.Verry" and I expected "nice".
Same result with ":" but works fine with "!?,;-".
Is it a bug or i missed something in the doc ?
"A trueWord is a word chunk, delimited by Unicode word breaks, as determined by the ICU Library. When there are no alphabetic or numeric characters between two word breaks, that string is not considered by LiveCode to be a trueWord."
Best regards
Jean-Marc
https://alternatic.ch
Re: problem trueword in a string with "."not followed by a
Joyeuses fetes, jean-marc !jmburnod wrote: put trueword 5 of "Cooking with livecode is nice.Verry Nice" return "nice.Verry" and I expected "nice".
Same result with ":" but works fine with "!?,;-".
If you need a quick solution, here is one:
Code: Select all
on mouseUp
put line -1 of the script of me into T
put trueword 5 of T --> nice.Very
put truetrueword(T, 5) --> nice
end mouseUp
function truetrueword txt, n
get "(?:\w+[^\w]){" & n - 1 & "}(\w+)"
get matchText( txt, IT, theWord)
return theWord
end truetrueword
Cooking with livecode is nice.Very Nice
Otherwise, must certainly be a bug..
Happy new year,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: problem trueword in a string with "."not followed by a
I felt that Santa Claus existed. I know now who he's and that He speaks french... and regex.
Thanks one more
It works fine to get the trueword of a string. I will try workaround using this to get the prev or next real true word.
Belles fêtes à toi aussi and happy new year
Jean-Marc
Thanks one more
It works fine to get the trueword of a string. I will try workaround using this to get the prev or next real true word.
I will fill a bug reportThierry wrote: Otherwise, must certainly be a bug.
Belles fêtes à toi aussi and happy new year
Jean-Marc
https://alternatic.ch
Re: problem trueword in a string with "."not followed by a
You're welcomed.jmburnod wrote: Thanks one more
It works fine to get the trueword of a string.
I will try workaround using this to get the prev or next real true word.
Be careful if you want to use it; I don't think it will be generic enough
but it's easy to modify for different inputs.
Feel free to contact me off-list; you know where I am...
Regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: problem trueword in a string with "."not followed by a
I filled a bug report
Bug 19038 - trueword in a string with "." or ":" not followed by a space, unexpected result
Jean-Marc
Bug 19038 - trueword in a string with "." or ":" not followed by a space, unexpected result
Jean-Marc
- Attachments
-
- stTestTrueWord.zip
- (1.24 KiB) Downloaded 145 times
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: problem trueword in a string with "."not followed by a
I suspect the issue is in the library that LC uses, and is probably an intentional decision. Decimal numbers would break, for example, since "123.8645" would not be a word any longer. It would also error with file paths and URLs. Just a guess.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: problem trueword in a string with "."not followed by a
Thanks Jacqueline and hapy new year,
I will find a workaround to avoid space missed after "." or ":" in the target text.
Jean-Marc
P.S : I'm endind 2016 with a 805 score on your Klondike game.
I will find a workaround to avoid space missed after "." or ":" in the target text.
Jean-Marc
P.S : I'm endind 2016 with a 805 score on your Klondike game.
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: problem trueword in a string with "."not followed by a
I wish everyone a year of peace and 805s.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: problem trueword in a string with "."not followed by a
Hi All,
Bug 19038 confirmed by LiveCode quality center
Best
Jean-Marc
Edit: There is different opinions if that is a bug or not.
It seems that the best way is to apply ponctuation rules when the text is written.
Bug 19038 confirmed by LiveCode quality center
Best
Jean-Marc
Edit: There is different opinions if that is a bug or not.
It seems that the best way is to apply ponctuation rules when the text is written.
https://alternatic.ch