Tuesday, 26 April 2022

How to Encode a string to Base64 format in Apex

 Hi ,

Here we are going to learn how to encode a string to Base64 format in Apex 

Eg:

String urlparam = 'Salesforce Techbook';

String urlString = EncodingUtil.base64Encode(Blob.valueof(urlparam));

System.debug(urlString);

Output: U2FsZXNmb3JjZSBUZWNoYm9vaw==


Reference: 

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_restful_encodingUtil.htm

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_encoding.htm


No comments:

Post a Comment

What’s the difference between Einstein Article Recommendations and Suggested Articles?

How Does Einstein Article Recommendations Work? Einstein Article Recommendations helps support agents resolve customer cases efficiently by ...