mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-11-04 12:17:37 +01:00 
			
		
		
		
	Merge pull request #1399 from CosminCremarenco-Murex/fix-starts-with-ends-with
Fix String.h startsWith/endsWith
This commit is contained in:
		@@ -627,7 +627,7 @@ template <class S>
 | 
				
			|||||||
bool startsWith(const S& str, const S& prefix)
 | 
					bool startsWith(const S& str, const S& prefix)
 | 
				
			||||||
	/// Tests whether the string starts with the given prefix.
 | 
						/// Tests whether the string starts with the given prefix.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return equal(prefix.begin(), prefix.end(), str.begin());
 | 
						return str.size() >= prefix.size() && equal(prefix.begin(), prefix.end(), str.begin());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -635,7 +635,7 @@ template <class S>
 | 
				
			|||||||
bool endsWith(const S& str, const S& suffix)
 | 
					bool endsWith(const S& str, const S& suffix)
 | 
				
			||||||
	/// Tests whether the string ends with the given suffix.
 | 
						/// Tests whether the string ends with the given suffix.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return equal(suffix.rbegin(), suffix.rend(), str.rbegin());
 | 
						return str.size() >= suffix.size() && equal(suffix.rbegin(), suffix.rend(), str.rbegin());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user