-
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

Whitelist IP Address in Salesforce
How to Whitelist IP Address in Salesforce! Whitelisting basically ensures that the firewall will not block your browsers from loading the page. Don’t forget to…

Accelerate Quote to Cash with DemandBlue’s Revenue Cloud Accelerator Program
Organizations that need to enhance their quote-to-cash process and accelerate revenue growth consider Salesforce Revenue Cloud the best-fit solution due to its boundless capabilities and…

What is Salesforce Net Zero Cloud?
Barely a day goes by without there being something in the news about climate change, sustainability or carbon footprints. It is a major focus for…
Popular Salesforce Videos
Use Salesforce Notification Builder to Get Notifications to the Right Users in the Right Apps
Did you know you can use Notification Builder to create custom notifications for teams, task queues, and public groups? You can also replace standard notifications…
An Introduction to Salesforce org Nonprofit Cloud
Did you know that over 30,000 nonprofit organizations use Salesforce? Salesforce.org’s premier product, NPSP, helps nonprofits drive greater impact by connecting everything they do. Learn…
Salesforce Admin Tutorial for Beginners 2022
Complete Salesforce Admin Tutorial 00:00:00 Salesforce - Introduction 00:01:27 Salesforce - Types of Services 00:02:21 Salesforce - Cloud Services 00:07:51 Salesforce - Developer Account 00:16:09…