-
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 7 years ago by
Yogesh.
-
This discussion was modified 7 years ago by
Forcetalks.
-
This discussion was modified 7 years ago by
Log In to reply.
Popular Salesforce Blogs
A Gift! for Salesforce Developers - Automatically convert Existing Visualforce Pages to Lightning (Beta)
Yes! that's right. It's a beautiful gift from Salesforce, giving us (developers) the ability to code in both Lightning Experience and Classic without having to…
Top 5 Best Practices for Managing Data in Salesforce
Companies rely on Salesforce to help them make sense of all the data they collect, and if we take into account that Salesforce currently holds…
Building Your First App for Salesforce AppExchange: A Step-by-Step Solution
Are you looking to build an application for Salesforce AppExchange? You must be familiar with Salesforce and how it works. Knowing the platform's capabilities can…
Popular Salesforce Videos
Understanding Products & Pricebooks in Salesforce
In this video, Shrey gave detailed information about products and pricebooks You will also learn: 1. How to add and manage Products in Salesforce? 2.…
Salesforce Lightning Development Tutorial - Hello World!
Salesforce Lightning Custom Component Development Tutorial for Beginners - Let us implement our first custom lightning component - Hello World! Video Resource: Lightning Evangelist
Salesforce is a fancy database
In this video, We will learn about the Salesforce Database (Data Modelling) in-depth in an interesting and fun way. I have divided this video into…