Factor out a splitSwitchCase() function so that it can be reused.