String Split method in Apex in Salesforce

Sample Code:

String str = 'abc-xyz-123';
List < String > strList = str.split( '-' );
System.debug( 'List String is ' + strList );


Output: