mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-24 22:52:32 +02:00 
			
		
		
		
	Improve sway/language
This commit is contained in:
		
							
								
								
									
										15
									
								
								include/util/string.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								include/util/string.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| #include <string> | ||||
|  | ||||
| const std::string WHITESPACE = " \n\r\t\f\v"; | ||||
|  | ||||
| std::string ltrim(const std::string s) { | ||||
|   size_t begin = s.find_first_not_of(WHITESPACE); | ||||
|   return (begin == std::string::npos) ? "" : s.substr(begin); | ||||
| } | ||||
|  | ||||
| std::string rtrim(const std::string s) { | ||||
|   size_t end = s.find_last_not_of(WHITESPACE); | ||||
|   return (end == std::string::npos) ? "" : s.substr(0, end + 1); | ||||
| } | ||||
|  | ||||
| std::string trim(const std::string& s) { return rtrim(ltrim(s)); } | ||||
		Reference in New Issue
	
	Block a user
	 dmitry
					dmitry