четверг, 15 октября 2015 г.

Introducing concat – pretty Apex string builder for Salesforce/Force.com

Concatenating strings in Apex with "+" operator  or String.join() can be full of pain. Unwanted spaces and commas. Empty or null strings. Ugly cascades of checks. Familiar?

Concat provides a solution!

It's key features are:

  • Null- and empty string safe
  • Clear chaining syntax

 
String result = 
concat.strings('Apex', 'can', 'be').add('less').add('').
       add(null).add('painful').with('-').end('!');

Pretty easy, huh?

Комментариев нет:

Отправить комментарий