Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #235 Decode base64

Assign to byte array data the bytes represented by the base64 string s, as specified by RFC 4648.

using System;
byte[] bytes = Convert.FromBase64String(s);
import "dart:convert";
var bytes = base64Decode(s);
import "encoding/base64"
data, err := base64.StdEncoding.DecodeString(s)
final data = s.decodeBase64()
var data = atob(s)
import java.util.Base64;
byte[] data = Base64.getDecoder().decode(s);
import java.util.Base64
String(Base64.getDecoder().decode(s))
uses base64;
data := DecodeStringBase64(s, true);
use MIME::Base64;
my @s = decode_base64($data);
import base64
data = base64.decode(s)
require "base64"
data = Base64.strict_decode64(s)
let bytes = base64::decode(s).unwrap();
Imports System
Dim bytes As Byte() = Convert.FromBase64String(s)

New implementation...
< >
programming-idioms.org