VB.Net Tutorial/Data Type/Base64String

Материал из VB Эксперт
Перейти к: навигация, поиск

Convert string to base64string

Public Class Tester
    Public Shared Sub Main
        Dim quote As String = "AAAAA"
        Dim quoteBytes As Byte() = System.Text.Encoding.UTF8.GetBytes(quote)
        Dim quote64 As String = Convert.ToBase64String(quoteBytes)
        Dim byteSet As Byte() = Convert.FromBase64String(quote64)
        
        Dim result As String = System.Text.Encoding.UTF8.GetString(byteSet)
        
        Console.WriteLine(quote & vbNewLine & quote64 & vbNewLine & result)
    End Sub
End Class
AAAAA
QUFBQUE=
AAAAA