Very nice !

-----Original Message-----
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of 
Bob Sneidar via use-livecode
Sent: 23 April 2019 19:24
To: How to use LiveCode
Cc: Bob Sneidar
Subject: Re: Open Printing to PDF

This may help to clean up all kinds of badness in text used for a number of 
things: 

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. 
   sample: put cleanASCII("This is a test!<>?", "uppercase,lowercase", "?"
   returns: "This is a test?"
   */
   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

> On Apr 23, 2019, at 11:00 , General 2018 via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Not a bug - my fault !!
> 
> The part of the heading text for the pdf is used for the saved filename which 
> cannot be  ">" ! of course .......
> 
> The issue was the file save naming not open printing to pdf command , your 
> replies made me look for odd characters.
> 
> Regards
> Cam


_______________________________________________
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

_______________________________________________
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

Reply via email to