Simplify code with strnsplit.