mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 21:42:59 +00:00 
			
		
		
		
	hprint:: added as_nice_cstring
This commit is contained in:
		
							
								
								
									
										13
									
								
								hprint.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								hprint.cpp
									
									
									
									
									
								
							| @@ -436,6 +436,19 @@ EX string as_cstring(string o) { | ||||
|   return s; | ||||
|   } | ||||
|  | ||||
| EX string as_nice_cstring(string o) { | ||||
|   string s = "\""; | ||||
|   for(char c: o) | ||||
|     if(c >= 32 && c < 126) | ||||
|       s += c; | ||||
|     else if(c == 10) | ||||
|       s += "\\n"; | ||||
|     else | ||||
|       s += format("\\x%02x", (unsigned char) c); | ||||
|   s += "\""; | ||||
|   return s; | ||||
|   } | ||||
|  | ||||
| #if HDR | ||||
| #if ISANDROID | ||||
| #define DEBB(r,x) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue