I seem to recall someone saying that when text is pasted into a text area, the line endings get converted to Mac line endings, regardless of the platform on which the application is running. Is that true?
The problem I’m having is that my application takes text from a text field and then uses the split function with EndOfLine as the delimiter to break the text into one line per array element. It works as expected on a Mac, but when deployed on Windows, the entire chunk of text seems to be going into the first array element.
Regardless of platform, it’s good practice to normalize your line endings before attempting to Split your text. It doesn’t matter what you choose to normalize them as, only that you do. For example:
dim myText as string = FromSomeSource
myText = ReplaceLineEndings( myText, EndOfLine )
dim lines() as string = myText.Split( EndOfLine )
Something like that will work in all cases on any platform.
Yes. That works, thanks.
For some reason I’d been under the impression that textareas used whatever endofline was associated with the platform on which it’s running. In retrospect, that wouldn’t make a lot of sense.
Seems to be working now, except for some other minor Windows idiosyncrasies.