parent
							
								
									0ef3e7b52f
								
							
						
					
					
						commit
						560bfdd493
					
				
				 3 changed files with 0 additions and 56 deletions
			
			
		@ -1,45 +0,0 @@ | 
				
			||||
#include "string_tools.h" | 
				
			||||
 | 
				
			||||
namespace Bk::Tools { | 
				
			||||
    std::string string_to_lower(std::string& str) | 
				
			||||
    { | 
				
			||||
        for (int i = 0; i < str.length(); i++) | 
				
			||||
        { | 
				
			||||
            str[i] = std::tolower(str[i]); | 
				
			||||
        } | 
				
			||||
        return str; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    std::string string_to_upper(std::string& str) | 
				
			||||
    { | 
				
			||||
        for (int i = 0; i < str.length(); i++) | 
				
			||||
        { | 
				
			||||
            str[i] = std::toupper(str[i]); | 
				
			||||
        } | 
				
			||||
        return str; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    std::unique_ptr<std::vector<std::string>> string_split(std::string& str, std::string delimiter, int cpt) | 
				
			||||
    { | 
				
			||||
        std::string s(str); | 
				
			||||
        std::unique_ptr<std::vector<std::string>> splits(new std::vector<std::string>(0)); | 
				
			||||
        size_t pos = 0; | 
				
			||||
        while (((pos = s.find(delimiter)) != std::string::npos) && cpt-- != 0) 
 | 
				
			||||
        { | 
				
			||||
            splits->push_back(s.substr(0, pos)); | 
				
			||||
            s.erase(0, pos + delimiter.length()); | 
				
			||||
        } | 
				
			||||
        if (s.length()) splits->push_back(s); | 
				
			||||
        return splits; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    void string_trim(std::string& str, const std::string& whitespace) | 
				
			||||
    { | 
				
			||||
        const auto strBegin = str.find_first_not_of(whitespace); | 
				
			||||
        const auto strEnd = str.find_last_not_of(whitespace); | 
				
			||||
        if (strBegin != std::string::npos) | 
				
			||||
        { | 
				
			||||
            str.erase(0, strBegin); | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -1,10 +0,0 @@ | 
				
			||||
#pragma once | 
				
			||||
 | 
				
			||||
#include <bakanetpch.h> | 
				
			||||
 | 
				
			||||
namespace Bk::Tools { | 
				
			||||
    std::string string_to_lower(std::string& str); | 
				
			||||
    std::string string_to_upper(std::string& str); | 
				
			||||
    std::unique_ptr<std::vector<std::string>> string_split(std::string& str, std::string delimiter, int cpt = -1); | 
				
			||||
    void string_trim(std::string& str, const std::string& whitespace = " \b\0"); | 
				
			||||
} | 
				
			||||
					Loading…
					
					
				
		Reference in New Issue