By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,654 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Square characters at end of string

P: n/a
Hi all,

I have a function in VB that reads values in a text file on my hard
drive, and returns the value read as a String.

However, when I check the value in the locals window of the VBE, it has
two little squares at the end, as follows:
1234.10□□

I want this to be removed, have tried using the Trim function but that
does nothing. What are these two things doing there, are they
„Carriage Return“ and „Line Feed“? And how do I get rid of
them? Must I do something with Right() or is there a simpler way?

Thanks in advance for the help.

Regards

J

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 21 Apr 2005 06:15:10 -0700, "Jean" <je**********@hotmail.com>
wrote:

Use the ASC function to find out what they are. Type this in the
Immediate window:
?Asc(Mid$(mystring,8,1)
?Asc(Mid$(mystring,9,1)
(of course replacing mystring with your string variable.
My guess it that you will get 13 and 10, the ASCII values for CR and
LF.
Then strip them off using the Left$ function.

-Tom.

Hi all,

I have a function in VB that reads values in a text file on my hard
drive, and returns the value read as a String.

However, when I check the value in the locals window of the VBE, it has
two little squares at the end, as follows:
1234.10??

I want this to be removed, have tried using the Trim function but that
does nothing. What are these two things doing there, are they
Carriage Return and Line Feed? And how do I get rid of
them? Must I do something with Right() or is there a simpler way?

Thanks in advance for the help.

Regards

J


Nov 13 '05 #2

P: n/a
Jean wrote:
Hi all,

I have a function in VB that reads values in a text file on my hard
drive, and returns the value read as a String.

However, when I check the value in the locals window of the VBE, it
has two little squares at the end, as follows:
1234.10??

I want this to be removed, have tried using the Trim function but that
does nothing. What are these two things doing there, are they
"Carriage Return" and "Line Feed"? And how do I get rid of
them? Must I do something with Right() or is there a simpler way?


All you can say for sure at first glance is that they are some sort of
non-printing character. In the example you gave you could use...

?asc(mid(YourValue,8,1)) <Enter>

....and it would give you the ascii number for the first "box" which you
could look up in the help file to see what it is. Once you know the ascii
values you can use the Replace() function to remove them.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #3

P: n/a
Br
In news:11**********************@o13g2000cwo.googlegr oups.com,
Jean <je**********@hotmail.com> said:
Hi all,

I have a function in VB that reads values in a text file on my hard
drive, and returns the value read as a String.

However, when I check the value in the locals window of the VBE, it
has two little squares at the end, as follows:
1234.10??

I want this to be removed, have tried using the Trim function but that
does nothing. What are these two things doing there, are they
"Carriage Return" and "Line Feed"? And how do I get rid of
them? Must I do something with Right() or is there a simpler way?


Yes it most likely is the carriage return and linefeed characters.

How are you importing the text? Perhaps try a different method.

Br@dley
Nov 13 '05 #4

P: n/a
Thanks guys...I settled in the end for just cutting off the last two
characters, as these characters are inserted regularly.

I am using the following to read a text file:

'read value saved to temp. text file
Open strTextfile For Input As #1
strResult = Input(LOF(1), #1)
Close #1

It seems that because this reads only one line, those characters are
then filled in.

Regards,
Jean

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.