Sample Code for String between double quotes:
String str = ‘a”abc”‘;
System.debug( ‘String between quotes is ‘ + str.subStringBetween( ‘”‘, ‘”‘ ) );
Output:
String str = ‘a”abc”‘;
System.debug( ‘String between quotes is ‘ + str.subStringBetween( ‘”‘, ‘”‘ ) );
Output:
Sample Code for String between white spaces:
String str = ‘ abcxyz ‘;
System.debug( ‘String between space is ‘ + str.subStringBetween( ‘ ‘, ‘ ‘ ) );
System.debug( ‘String between space is ‘ + str.subStringBetween( ‘ ‘, ‘ ‘ ) );
Output: