can't concat more than 2 strings

  • Thread starter Thread starter Nikhil Patel
  • Start date Start date
N

Nikhil Patel

Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find that the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
Hi,

It does appear on mine :
string strWorkArea = "test";

string strDDEExpression="[Replace(" + strWorkArea + ",";

therefore maybe is something in the strWorkArea string , are you sure it
does not contain a nonprintable character?

Hope this help,
 
Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null char.

Hope this helps
Jay
 
Jay, Yes it does.
I need only 8 characters of the string. But the value is assigned by an
WINAPI call. So it always puts ninth character '\0'. Can I get rid of it. If
so how?

Thanks.

Jay B. Harlow said:
Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null char.

Hope this helps
Jay

Nikhil Patel said:
Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find that the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
Thanks all.

This is what I did and it works.
string strDDEExpression="[Replace(" +
strWorkArea.Remove(strWorkArea.Length-1,1) + ",";
 
How do I simulate what you have and embedd a null character in a string
using C#

I know you found the solution to your problem


Nikhil Patel said:
Jay, Yes it does.
I need only 8 characters of the string. But the value is assigned by an
WINAPI call. So it always puts ninth character '\0'. Can I get rid of it. If
so how?

Thanks.

Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null char.

Hope this helps
Jay

Nikhil Patel said:
Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find that the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
News VS.NET ( MS ILM ),
(what an odd name).

string s = "Hello World\0There is an embedded null char"

The '\0' causes a null char to be embedded in the string at that position.

Hope helps
Jay

News VS.NET ( MS ILM ) said:
How do I simulate what you have and embedd a null character in a string
using C#

I know you found the solution to your problem


Nikhil Patel said:
Jay, Yes it does.
I need only 8 characters of the string. But the value is assigned by an
WINAPI call. So it always puts ninth character '\0'. Can I get rid of
it.
If
so how?

Thanks.

Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null char.

Hope this helps
Jay

Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find that the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
Jay,

In the debugger I still can see the "\0"
How did the origianl poster did not see the "\0"

Jay B. Harlow said:
News VS.NET ( MS ILM ),
(what an odd name).

string s = "Hello World\0There is an embedded null char"

The '\0' causes a null char to be embedded in the string at that position.

Hope helps
Jay

News VS.NET ( MS ILM ) said:
How do I simulate what you have and embedd a null character in a string
using C#

I know you found the solution to your problem


Nikhil Patel said:
Jay, Yes it does.
I need only 8 characters of the string. But the value is assigned
by
an
WINAPI call. So it always puts ninth character '\0'. Can I get rid of
it.
If
so how?

Thanks.

Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null
char.

Hope this helps
Jay

Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find
that
the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
Jay,
Followed your example:
string myStr = "123456789\0";

string strDDEExpression="[Replace(" + myStr + ",";

I still don't have the problem of not seeing ","



Thank you

Jay B. Harlow said:
News VS.NET ( MS ILM ),
(what an odd name).

string s = "Hello World\0There is an embedded null char"

The '\0' causes a null char to be embedded in the string at that position.

Hope helps
Jay

News VS.NET ( MS ILM ) said:
How do I simulate what you have and embedd a null character in a string
using C#

I know you found the solution to your problem


Nikhil Patel said:
Jay, Yes it does.
I need only 8 characters of the string. But the value is assigned
by
an
WINAPI call. So it always puts ninth character '\0'. Can I get rid of
it.
If
so how?

Thanks.

Nikhil,
Does strWorkArea have an embedded null char in it? A "\0"?

The debugger will truncate displaying the string at the embedded null
char.

Hope this helps
Jay

Hi,
I have following line in my c# code.

string strDDEExpression="[Replace(" + strWorkArea + ",";

When I run this and check the value in strDDEExpression, I find
that
the
comma is missing.

Any idea?

Thanks...

-Nikhil
 
Back
Top