0

Hi!

I want to join 2 strings, but it has been impossible.
I have this:

i = socket.Receive(buffer);
 recibido = System.Text.Encoding.UTF8.GetString(buffer)

Buffer contains: "C:"

I want to add the "\\" to the string so i have tried to do:

recibido = recibido + "\\".

But no way, when y print the result it shows again "C:"
I have also tried using StringBuilder:
http://msdn.microsoft.com/en-us/library/ms228504(v=vs.80).aspx

But is the same it just print "C:"

I ve also tried changing the "\\" for any other thing like "hello"... and it still shows "C:".

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by krosty4782
0

>I want to join 2 strings, but it has been impossible.

What is the size of buffer (length of buffer array)?

string str = System.Text.Encoding.UTF8.GetString(buffer,0,2) + "\\";
0

You were right.
The problem is that i ve benn using "System.Text.Encoding.UTF8.GetString" without the to parameters "0" and "2". For what are they ?

0

Please read MSDN documentation.

System.Text.Encoding.UTF8.GetString(byteArray,offset,Length)
0

Thanks, i searched in google before making the question but i didnt find anything.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.