mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	loader.cpp: improved file extension checking, made Upper/LowerStr useful
Instead of forcibly taking the last 4 characters, it now finds the last extension separator (the period) and takes a substr of its location.
This commit is contained in:
		
							parent
							
								
									335082e74e
								
							
						
					
					
						commit
						4ed24a0619
					
				
					 3 changed files with 17 additions and 18 deletions
				
			
		|  | @ -18,19 +18,15 @@ | |||
| #endif | ||||
| 
 | ||||
| /// Make a string lowercase
 | ||||
| void LowerStr(char* str) { | ||||
|     for (int i = 0; str[i]; i++) { | ||||
|         str[i] = tolower(str[ i ]); | ||||
|     } | ||||
| std::string LowerStr(std::string str) { | ||||
|     std::transform(str.begin(), str.end(), str.begin(), ::tolower); | ||||
|     return str; | ||||
| } | ||||
| 
 | ||||
| /// Make a string uppercase
 | ||||
| void UpperStr(char* str) { | ||||
|     for (int i=0; i < strlen(str); i++) { | ||||
|         if(str[i] >= 'a' && str[i] <= 'z') { | ||||
|             str[i] &= 0xDF; | ||||
|         } | ||||
|     } | ||||
| std::string UpperStr(std::string str) { | ||||
|     std::transform(str.begin(), str.end(), str.begin(), ::toupper); | ||||
|     return str; | ||||
| } | ||||
| 
 | ||||
| // faster than sscanf
 | ||||
|  |  | |||
|  | @ -13,10 +13,11 @@ | |||
| #include "common/common.h" | ||||
| 
 | ||||
| /// Make a string lowercase
 | ||||
| void LowerStr(char* str); | ||||
| 
 | ||||
| std::string LowerStr(std::string str); | ||||
| 
 | ||||
| /// Make a string uppercase
 | ||||
| void UpperStr(char* str); | ||||
| std::string UpperStr(std::string str); | ||||
| 
 | ||||
| std::string StringFromFormat(const char* format, ...); | ||||
| // Cheap!
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue