Optimized String Check