Memos About Salesforce

Salesforceにハマってたこと!

文字列処理

プログラムを書く時に文字列は絶対出るもの 最近よく見るから、すごい気になってて、 書く量の少ない方法ごあるのに わざわざ下記のように書く人がいる

String testStr = 'this is test';
if(testStr != null && testStr !=''){
/*処理*/
}

実は sfdcの標準メソッドがあるんやで

isNotEmpty(inputString)
Returns true if the specified String is not empty ('') and not null; otherwise, returns false.

はっきり書いてある。

!=null && !=''はisNotEmpty()と同じだよー。

以上です。