Activity › Forums › Salesforce® Discussions › How to check if a string is empty in Apex in Salesforce? Salesforce® Discussions How to check if a string is empty in Apex in Salesforce? Posted by Anjali on August 28, 2020 at 12:16 PM How to check if a string is empty in Apex in Salesforce? Anuj replied 5 years, 9 months ago 3 Members · 2 Replies 2 Replies Kirandeep Member August 28, 2020 at 2:31 PM Hi, You can use isEmpty() method of String Class which returns true if the specified String is Empty OtherWise returns false This reply was modified 5 years, 9 months ago by Kirandeep. This reply was modified 5 years, 9 months ago by Kirandeep. [adinserter block='9'] Anuj Member August 28, 2020 at 3:07 PM public String CheckIt {get;set;} //Check IsNotEmpty public Boolean CheckisNotEmpty() { if(String.isNotEmpty(CheckIt)) { //String is not empty (”) and not null return true; } else { //String is empty (”) or blank or null return false; } } } Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me