Optimized String check