Re: Identifying empty lines of text
On Jan 12, 2018, at 16:48 , David Epstein via use-livecodewrote: I use “the number of words in myString = 0” to test whether a line of text appears empty, since I want a line with only space characters to be understood as empty. But a line of text I pasted from elsewhere contained an invisible character whose charToNum value is 202, and this was counted as a word by my script. Is there a better way to test for a line of text that has no visible characters? Here's where the "trueword" keyword comes in handy: put the number of truewords in line x of fld y It will ignore invisible and whitespace characters. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying empty lines of text
I have a simple function which will return a string with all non-allowed characters stripped from it. function cleanASCII pString, pModeList, pCustomList /* pModeList is a comma delimited list that may contain the following values: "lowercase,uppercase,numbers,tabs,newlines,returns,spaces,symbols,custom" If custom is used, then a third paramaeter containing allowed characters must be supplied. */ if pModeList is empty then put " 0-9a-zA-Z" into tAllowedChars end if repeat for each item pMode in pModeList put word 1 of pMode into pMode switch break case "tabs" is in pMode put "\t" after tAllowedChars break case "newlines" is in pMode put "\n" before tAllowedChars break case "returns" is in pMode put "\r" before tAllowedChars -- currently not working break case "spaces" is in pMode put " " after tAllowedChars break case "numbers" is in pMode put "0-9" after tAllowedChars break case "lowercase" is in pMode put "a-z" after tAllowedChars break case "uppercase" is in pMode put "A-Z" after tAllowedChars break case "symbols" is in pMode put "!#$%&'()*+,./:;<=>?@[\\_`{|}~^-" after tAllowedChars break case pMode is "custom" put pCustomList after tAllowedChars break end switch end repeat put "[" & tAllowedChars & "]" into tMatchText repeat for each character theChar in pString if matchtext(theChar, tMatchText) is true then put theChar after cleanString end if end repeat return cleanString end cleanASCII Bob S > On Jan 12, 2018, at 16:48 , David Epstein via use-livecode >wrote: > > I use “the number of words in myString = 0” to test whether a line of text > appears empty, since I want a line with only space characters to be > understood as empty. > But a line of text I pasted from elsewhere contained an invisible character > whose charToNum value is 202, and this was counted as a word by my script. > Is there a better way to test for a line of text that has no visible > characters? > Many thanks. > > David Epstein ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying empty lines of text
> hh wrote: > You could try to use (respects UCI word boundaries): > if the num of trueWords in myString is 0 > Works here in LC 7 and later. Sorry: ICU - International Components for Unicode (not UCI). >> I use “the number of words in myString = 0” to test whether >> a line of text appears empty, since I want a line with only >> space characters to be understood as empty. >> But a line of text I pasted from elsewhere contained an >> invisible character whose charToNum value is 202, and this >> was counted as a word by my script. >> Is there a better way to test for a line of text that has no >> visible characters? >> Many thanks. >> >> David Epstein ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying empty lines of text
You could try to use (respects UCI word boundaries): if the num of trueWords in myString is 0 Works here in LC 7 and later. > I use “the number of words in myString = 0” to test whether > a line of text appears empty, since I want a line with only > space characters to be understood as empty. > But a line of text I pasted from elsewhere contained an > invisible character whose charToNum value is 202, and this > was counted as a word by my script. > Is there a better way to test for a line of text that has no > visible characters? > Many thanks. > > David Epstein ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Identifying empty lines of text
I wonder if the 202 value would disappear if you did this: put textDecode(the clipboarddata["text"], "utf8") into field 1 I don't know the answer, just putting it out there. Phil Davis On 1/12/18 4:48 PM, David Epstein via use-livecode wrote: I use “the number of words in myString = 0” to test whether a line of text appears empty, since I want a line with only space characters to be understood as empty. But a line of text I pasted from elsewhere contained an invisible character whose charToNum value is 202, and this was counted as a word by my script. Is there a better way to test for a line of text that has no visible characters? Many thanks. David Epstein ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- Phil Davis ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Identifying empty lines of text
I use “the number of words in myString = 0” to test whether a line of text appears empty, since I want a line with only space characters to be understood as empty. But a line of text I pasted from elsewhere contained an invisible character whose charToNum value is 202, and this was counted as a word by my script. Is there a better way to test for a line of text that has no visible characters? Many thanks. David Epstein ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode