Link to home
Start Free TrialLog in
Avatar of jackjeckyl
jackjeckyl

asked on

Identifying unknown character in text file

Hi, I have a text file that I need to split into numerous lines but the sepeartor is not a vblf or vbcr or vbcrlf.  I don't know what it is.  It comes across as a box in notepad.  How can I found out what it is so I can split the file into a format I can use?
Avatar of DennisL
DennisL

Copy and paste the character into a vb project that just has a textbox.  Place a button on the form and within the code for the button put.

dim i as integer

for i = 1 to len(text1)
   debug.print mid(text1, i, 1) & " - " & asc(mid(text1, i, 1)
next i
' the for statement is just in case you paste more than one character.

This will display the ascii value of the character in question.

Hope this helps.
You can use the Immediate window to determine which character this is:

?asc(vblf)
 10
?asc(vbcr)
 13
?asc(<the mystery character here>)
 
ASKER CERTIFIED SOLUTION
Avatar of pit__
pit__

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I play with file formats a lot actually, and one of the best tools in my opinion is good 'ole Microsoft Edit...  pull up a DOS prompt and type "edit /070 <filename>"  The '/070' tells edit to open the file in binary mode with a line width of 70 characters (the leading 0 is important)

By doing it this way, you can browse through the file, make changes to it, while not losing any special characters that notepad throws away.  If you move the cursor over the characters in question, you can then look at the bottom right corner of the edit screen and see the character code for it, in decimal.  Then to check for that character later in VB code, just use the Instr() command... for example, if the file uses a Null (character code=0) as a seperator, you could find the first separator in a file using:


Open strFile For Binary As 1

strData = LOF(1)
Get #1, , strData
nPos = Instr(1, strData, chr(0))
Most likely it's a tab character (chr$(9)=vbTab), but the above methods should show you the code number for it.
Well, if all you want to do is read the document, then just open it up in word. Word recognizez this character as a line break.

Regards,
Avatar of jackjeckyl

ASKER

That'll work, thank you.
do i get the points ?!?!

Regards,
do i get the points ?!?!

Regards,