redis值中字符的长度

6kkfgxo0  于 2021-06-08  发布在  Redis
关注(0)|答案(0)|浏览(220)

嘿,我是新来的。我想用vb.net创建自己的redis cli。我找到了这样的证明

Imports System.Net.Sockets
Imports System.Text

Module Module1
Sub Main()
    Dim stream As NetworkStream
    Dim client As TcpClient
    Dim bytes() As Byte
    Dim result As String
    Try
        client = New TcpClient()
        client.Connect("127.0.0.1", 6379)
        stream = client.GetStream()

        bytes = Encoding.UTF8.GetBytes("keys *" & vbCrLf)
        stream.Write(bytes, 0, bytes.Length)
        stream.Flush()
        ReDim bytes(client.ReceiveBufferSize)
        stream.Read(bytes, 0, bytes.Length)
        result = Encoding.UTF8.GetString(bytes)
        result = Left(result, InStrRev(result, vbCrLf))

        Console.WriteLine("Result:" + result)
    Catch ex As Exception
        Console.WriteLine("Error:" + ex.ToString())
    End Try

End Sub

End Module

事实上它很管用。但为什么结果总是给我一个字符长度?我可以在哪里删除它?结果如下:

是啊,因为我只有一把钥匙

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题