-
Why does NULL count as 4 characters in Salesforce Apex?
If I execute the block of code in the Anonymous window, it returns 8 as the length of the string. Do null string count towards the string length in Apex?
String s = 'Yosh';
String e = null;
String y = s + e;
System.Debug(y.trim().length()); //Returns 8 characters. Should return 4-
This discussion was modified 5 years, 6 months ago by
Yogesh.
-
This discussion was modified 5 years, 6 months ago by
Forcetalks.
-
This discussion was modified 5 years, 6 months ago by
Log In to reply.
Popular Salesforce Blogs

The 'Sharing' button is not available in the Salesforce Lightning Experience UI: Here's a solution for this!
In Salesforce Classic - Admins are able to add a standard "sharing" button to most record page layouts - allowing admins to view all of…

Enhance Your Fundraising Efforts by Integrating Your Organization's System With Salesforce
As per Salesforce.org's Nonprofit Trends Report (3rd Edition), the pandemic forced 71 percent of organizations polled to speed up their transition to digital programs or…
Popular Salesforce Videos
Tips to Crack the Salesforce Administrator Certification Exam in One Go
Do you want to become Salesforce administrator certified? So in this video Shrey has shared the important topics to crack the Salesforce Administrator Exam. Following…
Multipurpose VF Component to Add Multiple Records on a Button's Click | Salesforce Tutorials
In this video, I will create a multipurpose VF component to add Contact records in a list on the click of a button then I…
Public Groups In Salesforce | Salesforce Development Tutorial
Public Groups In Salesforce. In this video, the following points will be covered - 1. Introduction Get a brief introduction about public groups. 2. Purpose…