How to get Sub String of String using two Strings in Salesforce using Apex? August 6, 2015June 9, 2022InfallibleTechie Admin substringBetween() is used to get Sub String of String using two Strings in Salesforce using Apex. Sample Code: String s1 = ‘abTestingcd’; String s2 = s1.substringBetween(‘ab’,’cd’); system.debug(‘s2 is ‘ + s2);//Testing Output: Cheers!!!