Word delimiters

Paul Dupuis paul at researchware.com
Sat Jun 10 19:57:38 EDT 2017


LiveCode 7+ see trueWord in the dictionary



On 6/10/2017 7:38 PM, hlowe via use-livecode wrote:
> Livecode defines a word as:
>
> "A word is delimited by one or more spaces, tabs, or returns, or is enclosed
> by double quotes."
>
> Generally this works well but if I have text in which one or more words are
> contained within either round brackets "(word1 word2)" or square brackets
> "[word1 word2]" the paren characters are considered part of the word.
>
> For example try this from the message box:
>
> "answer word 4 of "word1 (word2 word3) [word4 word5]"
>  the result is "[word4"
>  
> Thus searching for specific word chunks within text fails if the word is
> contained within a round or square bracket.
>
> For example:
>
> repeat for each word tWord in "red (blue green) [orange purple]"
> if tWord is "orange" then answer "found" 
> end repeat
>
> Though "orange" is a word (by general definition) in the text, it is not
> found.
>
> The same issue arises if there are certain punctuation characters at the end
> of a word e.g "orange;"
>
> Ideally one could define a set of comma-delimited characters that are
> considered word delimiters in the same way that we can (temporarily) change
> the itemDelimiter character:
>
> e.g. set the WordDelimiters to "~,(,),{,},[,],;,:,comma, return,space,tab"
>
> Similar to the itemDelimiter property, this property would be reset to the
> default when the handler completes.
>
> Perhaps there is already a solution to this that I don't know about? Yes,
> one can preprocess the input text to remove parens and certain punctuation
> characters but having the option for LiveCode to recognize them as word
> delimiters would be more elegant (IMHO).
>
> Henry
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Word-delimiters-tp4715709.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>





More information about the use-livecode mailing list