String Manipulation in Salesforce #1

Salesforce provide set of methods for String manipulation. This article explains usage of each function with examples.   Truncate strings with¬†ellipses. abbreviate(maxWidth)¬†returns a trimmed version of the String, of the specified length and with ellipses (…) appended if the current String is longer than the specified length; otherwise, returns the original String without ellipses. ‘Test […]

Loss of Fractions in Divisions

This is a small coding issue which can lead to serious calculation problems. When dividing numeric Integer or Long values, the fractional portion of the result, if any, is removed before performing any implicit conversions to a Double or Decimal. Eg – Double = 5/3; // Expected result = 1.6666666666666667 | Actual result = 1.0Double […]

Salesforce Coding Standards

This is an unofficial list of Salesforce Coding Standards sourced from various guidelines & coding standards from the internet. Salesforce recommends following Java standards for naming, that is, classes start with a capital letter, methods start with a lowercase verb, and variable names should be meaningful. Class Class name should be noun/s starting with capital […]