On 5/6/05 5:57 AM, "Allen Stare" <[EMAIL PROTECTED]> wrote:
> To my question: I am importing text files created in notepad on Windows. I'm
> using the readFile command with an instance of the FileIO Xtra in 8.5 to
> read the contents of the files. When I place the imported text in a field on
> the stage, the paragraph characters are showing up as boxes.

Hi Allen,

On Windows, new parargraphs are indicated by two characters: Carriage RETURN
+ Line Feed.  In Lingo, that would be written as
numToChar(13)&numToChar(10).  Director originated on Macintosh, so
internally, only RETURN characters are used.

The simplest solution to your problem would be to use the ReplaceAll()
handler (below) to replace all Line Feed characters with EMPTY:

  tContents = <read in data from NotePad file>
  tContents = ReplaceAll(tContents, numToChar(10), "")

Does this help?

James

----------------------------------------------------------------------------


on ReplaceAll(aString, aSubString, aReplacement) ---------------------
  -- INPUT: <aString> is the main string to search in
  --        <aSubString> is a string which may appear in <aString>
  --        <aReplacement> is a string which is to replace all
  --         occurrences of <aSubString> in <aString>
  -- OUTPUT: returns an updated version of <aString> where all
  --         occurrences of <aSubString> have been replaced by
  --         <aReplacement>
  --------------------------------------------------------------------
  
  if aSubString = "" then
    return aString
  end if
  
  tTreatedString = ""
  tLengthAdjust  = the number of chars of aSubString - 1
  
  repeat while TRUE
    tOffset = offset(aSubString, aString)
    if tOffset then
      if tOffset - 1 then
        put chars(aString, 1, (tOffset - 1)) after tTreatedString
      end if
      
      put aReplacement after tTreatedString
      delete char 1 to (tOffset + tLengthAdjust) of aString
      
    else -- there are no more occurrences
      put aString after tTreatedString
      return tTreatedString
    end if
    
  end repeat
end ReplaceAll

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[email protected]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to