apex如何保存多行字符串

虽然可以用换行符把很长的字符串放在一行,但是不便于阅读。apex没有像python中三个引号这种直接支持多行字符串的格式,可以用下面这种方法:

String query = 'SELECT Project__c,'
                  + ' Project__r.Testing_Submitted__c,'
                  + ' Project__r.Project_Sub_Phase__c,'
                  + ' Project__r.DRD_Submited__c,'
                  + ' Protected_Application__r.DRD_Completed__c,'
                  + ' Protected_Application__c,'
                  + ' Project__r.Id,'
                  + ' Project__r.Name,'
                  + ' Project__r.Project_Type__c,'
                  + ' Project__r.Remark__c,'
                  + ' Project__r.Record_Type_Name__c,'
                  + ' Project__r.RecordTypeId,'
                  + ' Project__r.Project_Actual_Completion__c,'
                  + ' Protected_Application__r.Application__c,'
                  + ' Project__r.Project_Phase__c,'
                  + ' Project__r.Ready_for_Testing__c,'
                  + ' Project__r.recordType.DeveloperName,'
                  + ' Project__r.Project_Sub_Status__c,'
                  + ' Project__r.Certification_was_submitted__c,'
                  + ' Project__r.Customer_confirmed_launch_date__c,'
                  + ' Protected_Application__r.Application_Type__c'
                + ' FROM ProjectAppLink__c ';

System.debug(query);

参考:https://salesforce.stackexchange.com/questions/150674/break-line-on-a-string

你可能感兴趣的:(Salesforce,salesforce)