我正在使用此代码从 tcpclient 返回一些字符串,但是当字符串返回时,它有一个前导"
字符。我正在尝试删除它,但该Len()
函数正在读取字节数而不是字符串本身。我怎样才能改变它来给我通常使用它的字符串的长度,而不是字符串本身的数组的长度?
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Output the data received from the host to the console.'
Dim returndata As String = Encoding.ASCII.GetString(bytes)
Dim LL As Int32 = Len(returndata)
Len()
报告字节数而不是字符串中的字符数。