<=?Utf-8?B?5bCP5a6J?= <@discussions.microsoft.com>> wrote:
> void myfunction(String * Parameter){
> String* test0 = S"A"; // Parameter is also "A",but its details is not
[quoted text clipped - 8 lines]
> that.(The Watch Pannel shows that it is just a "A");
> What 's the possible reason of this? How to avoid it?
I suspect you'll find that test2 is *actually* headA\0tail, but that
what you're using to display it is stopping as soon as it sees a \0.
The best fix for this is to try to work out why you're getting a \0 in
the first place, and avoid it. Otherwise, you can use String.Trim,
passing in \0 as the character to trim.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
小安 - 04 Dec 2005 11:49 GMT
Thank you!!
TrimEnd(S"\0"->ToCharArray()) can solve the problem.
“Jon Skeet [C# MVP]”编写:
> <=?Utf-8?B?5bCP5a6J?= <@discussions.microsoft.com>> wrote:
> > void myfunction(String * Parameter){
[quoted text clipped - 15 lines]
> the first place, and avoid it. Otherwise, you can use String.Trim,
> passing in \0 as the character to trim.