Use string scanner instead of low-level string processing