Converts ASCII-encoded data into unsigned binary data.
WebAPI.bdh
WebBase64Decode( out sTarget : string, inout nTarget : number, in sSource : string ): boolean;
true if the decoding was successful
false otherwise
Parameter | Description |
---|---|
sTarget | String variable to receive the data. |
nTarget | Maximum number of bytes to write into sTarget. This value must be less than or equal to the size of sTarget. nTarget will contain the length of the encoded binary data after a successful return. |
sSource | Source string to decode. |
For example, the string "dGVzdHVzZXI6dGVzdHBhc3M=" is converted to "testuser:testpass".
dcltrans transaction TWebBase64Decode var sPlain : string; sCoded : string(100); nPlainLen : number; nCodedLen : number; begin sPlain := "testuser:testpass"; write("plain: "); write(sPlain); writeln; WebBase64Encode(sCoded, sizeof(sCoded), nCodedLen, sPlain, Strlen(sPlain)); write("encoded: "); write(sCoded); writeln; nPlainLen := sizeof(sPlain); WebBase64Decode(sPlain, nPlainLen, sCoded); write("decoded: "); write(sPlain); writeln; end TWebBase64Decode;
plain: testuser:testpass encoded: dGVzdHVzZXI6dGVzdHBhc3M= decoded: testuser:testpass