Skip to content
master
Switch branches/tags
Go to file
Code

Files

Permalink
Failed to load latest commit information.

README.md

String2Base64

Ejemplo para convertir un texto a Base64 y convertir Base64 a texto. En la solución está el ejemplo de como usarlo.

C#

    /// <summary>
    /// Convierte string en Base64 a texto
    /// </summary>
    /// <param name="valor">Valor a reemplazar</param>
    /// <returns></returns>
    public static string DecodeBase64ToString(string valor)
    {
        byte[] myBase64ret = Convert.FromBase64String(valor);
        string myStr = System.Text.Encoding.UTF8.GetString(myBase64ret);
        return myStr;
    }

    /// <summary>
    /// Convierte texto string en Base64
    /// </summary>
    /// <param name="valor">Valor a reemplazar</param>
    /// <returns></returns>
    public static string EncodeStrToBase64(string valor)
    {
        byte[] myByte = System.Text.Encoding.UTF8.GetBytes(valor);
        string myBase64 = Convert.ToBase64String(myByte);
        return myBase64;
    }

VB

Public Shared Function DecodeBase64ToString(valor As String) As String
    Dim myBase64ret As Byte() = Convert.FromBase64String(valor)
    Dim myStr As String = System.Text.Encoding.UTF8.GetString(myBase64ret)
    Return myStr
End Function

Public Shared Function EncodeStrToBase64(valor As String) As String
    Dim myByte As Byte() = System.Text.Encoding.UTF8.GetBytes(valor)
    Dim myBase64 As String = Convert.ToBase64String(myByte)
    Return myBase64
End Function

About

Ejemplo para convertir un String a Base64 y pasar de Base64 a String

Resources

Releases

No releases published

Packages

No packages published

Languages