Rewrite splitString to use stdlib functions