mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 15:00:26 +00:00
hprint:: added as_nice_cstring
This commit is contained in:
parent
0f767e16b6
commit
087c815372
13
hprint.cpp
13
hprint.cpp
@ -436,6 +436,19 @@ EX string as_cstring(string o) {
|
|||||||
return s;
|
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 HDR
|
||||||
#if ISANDROID
|
#if ISANDROID
|
||||||
#define DEBB(r,x)
|
#define DEBB(r,x)
|
||||||
|
Loading…
Reference in New Issue
Block a user