Solved

Line endings

Posted on 2003-11-19
3
224 Views
Last Modified: 2012-05-04
Hi,

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.

Cheers
Lukey
0
Comment
Question by:lukethepunk
3 Comments
 
LVL 43

Accepted Solution

by:
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.

Tim Cottee MCSD, MCDBA, CPIM
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 

Assisted Solution

by:Gryff
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)
0
 

Author Comment

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

Cheers
Lukey
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now