Decode a base64 code into a scalar string.
use befor64 use penf character(:), allocatable :: code64 code64 = repeat(' ',5) call b64_decode(code='aGVsbG8=',s=code64) print "(L1)", code64=='hello'
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | code | Encoded scalar. |
||
character(len=*), | intent(out) | :: | s | String to be decoded. |
elemental subroutine b64_decode_string(code, s)
!< Decode a base64 code into a scalar string.
!<
!<```fortran
!< use befor64
!< use penf
!< character(:), allocatable :: code64
!< code64 = repeat(' ',5)
!< call b64_decode(code='aGVsbG8=',s=code64)
!< print "(L1)", code64=='hello'
!<```
!=> T <<<
character(*), intent(in) :: code !< Encoded scalar.
character(*), intent(out) :: s !< String to be decoded.
integer(I1P), allocatable :: nI1P(:) !< One byte integer array containing n.
allocate(nI1P(1:byte_size(s))) ; nI1P = 0_I1P
call decode_bits(code=code,bits=nI1P)
s = transfer(nI1P,s)
endsubroutine b64_decode_string