473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Square characters at end of string

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
4 8036
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Wade G. Pemberton | last post by:
Can't find it quickly in the reference books.
0
by: Fuochi | last post by:
hello, I have Visual Studio .Net 2002 C++. I have migrated a code created under VS 6.0 that contains a call to the method CreateField. This method fail in release mode if the string parameter...
5
by: ywchan | last post by:
I would like to convert a string to a fixed length e.g. if fixed length = 10 'abc' -> ' abc' 'abcdefghijklm' -> 'abcdefghij' Is there any simple function in C# can perform this operation?...
4
by: Diffident | last post by:
Hello All, I have a string of around 150 characters. string test = "asjhdkashdkjahsdjkhaskjdhaskjdhasjdhasd........."; //(upto 150 characters) I want to split the above string into multiple...
6
by: Diffident | last post by:
Dear Bruce, Can you please explain me how compiler would be able to optimize "+" for the below code? The reason why I did not want to use string concatenation was that I wanted it to be a...
3
by: et | last post by:
How can I strip out unwanted characters in a string before updating the database? For instance, in names & addresses in our client table, we want only letters and numbers, no punctuation. Is...
4
by: randy1200 | last post by:
Using Visual Studio 2005. I'm using XmlReader to read data into a string variable in C#. Works great! Every once in a while, I see that the string data contains a symbol that looks like a...
2
by: dani kotlar | last post by:
Is there a function that copies between string (or stringbuilder) objects, while filtering out certain types or designated characters, or leaving a certain typa of designates\d characters? For...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.