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

How to include a screen flow in a Lightning Web Component

 Hi, Assume  you have a flow called "Quick Contact Creation" and API Name for the same is "Quick_Contact_Creation". To i...