Today’s PD1 study involved Apex data types. While I’ve been writing code for a while and have a good grasp on general constructs, the completionist in me hates skipping topics (it seriously gives me anxiety).
While reviewing subjects that have been a part of your daily life – for like ever – can be a bit dull, it’s a good way to fill in any knowledge gaps on things that you don’t usually come across.
Todays gap filler was on sObject strings and their contempt for whitespace.
Empty Strings and Trailing Whitespace: sObject String field values follow the same rules as in the SOAP API: they can never be empty (only null), and they can never include leading and trailing whitespace. These conventions are necessary for database storage.From https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_primitives.htm
Contact c = new Contact(FirstName = '\u00A0\u00A0Leroy\u00A0\u00A0', LastName='\u00A0\u00A0Jenkins\u00A0\u00A0');
Not exactly sure what use case this would make sense for, but now we know it can be done =).