15 lines
		
	
	
		
			392 B
		
	
	
	
		
			C++
		
	
	
	
		
		
			
		
	
	
			15 lines
		
	
	
		
			392 B
		
	
	
	
		
			C++
		
	
	
	
|  | #pragma once
 | ||
|  | #include <string>
 | ||
|  | #include <cctype>
 | ||
|  | #include <algorithm>
 | ||
|  | 
 | ||
|  | std::string Tool_toLowerCase(const std::string &str) | ||
|  | { | ||
|  |     std::string result = str; | ||
|  |     // 使用transform算法遍历字符串并转换为小写
 | ||
|  |     std::transform(result.begin(), result.end(), result.begin(), | ||
|  |                    [](unsigned char c) | ||
|  |                    { return std::tolower(c); }); | ||
|  |     return result; | ||
|  | } |