Weird problem with concatenating strings ...

  • Thread starter Thread starter JustMe
  • Start date Start date
J

JustMe

I'm stumped.

I have a piece of code that iterates through a string looking for
substrings, which I then concatenate together using code like this:

newString = newString & oldString.substring(y,1)

This all works fine, however in the end, if I view the value of
newString in my 'command window' in visual studio, I show a value like
this:

"My Value

There is no ending quotation mark.

What the heck am I missing?

If I enter the following in the command window:

newString = newString

the value will then be as expected: "My Value"

However if I put that same piece of code in my aplication, the
resulting value still ends up with no closign quote.

Does anyone have any suggestions?

-Terry
 
JustMe said:
I'm stumped.

I have a piece of code that iterates through a string looking for
substrings, which I then concatenate together using code like this:

newString = newString & oldString.substring(y,1)

This all works fine, however in the end, if I view the value of
newString in my 'command window' in visual studio, I show a value like
this:

"My Value

There is no ending quotation mark.

What the heck am I missing?

If I enter the following in the command window:

newString = newString

the value will then be as expected: "My Value"

However if I put that same piece of code in my aplication, the
resulting value still ends up with no closign quote.

Does anyone have any suggestions?

Have you noticed any odd behaviour in the application itself, or only
in the debugger? I know that in VS.NET 2002 there were some problems
with string display in the debugger - I would hope that they'd all gone
by VS.NET 2003, but I would still only be really concerned if the
problem affected the app itself.
 
I ran into this quite a bit. In my case I found out that there were lots on
NULL characters dispersed in my strings that were returned from database
queries. I just tackled it head on by writing a function to strip out nulls.
 
Thanks everyone.

The problem was that the loop was going one character too far. As a
result, the last character appended to my newstring was a 'null' ...
once I fixed the loop so it only looped to the last valid character,
everythign works fine.

I still find it Weird though that the problem would occur as the code
was written.

Thanks again,
--Terry
 
Back
Top