Line endings

Posted on 2003-11-19
Last Modified: 2012-05-04

I need to read a text file into my app that has come from an apple macintosh. The trouble is the line endings are all in mac format and its throwing me off when i read the lines in.

Is there a way i can get vb to replace the mac line endings with dos ones, or is there a simple app out there to do it.

Question by:lukethepunk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 43

Accepted Solution

TimCottee earned 125 total points
ID: 9777973
Hi lukethepunk,

What characters are used to represent the line end?

If you can find this out you can use:

MyString = Replace(MyString,<MACLINEENDCHAR>,vbCrLf)

To replace the <MACLINEENDCHAR> with carriage return and line feed.

Brainbench MVP for Visual Basic

Assisted Solution

Gryff earned 125 total points
ID: 9778252
I believe Macintosh ends it's lines in just a CR, so in Tims example you would do...

MyString = Replace(MyString, vbCr,vbCrLf)

Author Comment

ID: 9778845
Thanks to both of you, that works fine. I did'nt think about doing it that way.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month3 days, 15 hours left to enroll

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question