Extract hexDump function
This commit is contained in:
parent
852932a934
commit
7f7959778c
13
src/util.h
13
src/util.h
@ -246,6 +246,19 @@ enum class ExtendedChar {
|
||||
GreekSmallLetterPhi = 0xed,
|
||||
};
|
||||
|
||||
String hexDump(String in) {
|
||||
String out;
|
||||
for (size_t i = 0; i < in.length(); ++i) {
|
||||
auto hexChar = String(in[i], HEX);
|
||||
if (hexChar.length() == 1) {
|
||||
out.concat('0');
|
||||
}
|
||||
out.concat(hexChar);
|
||||
out.concat(' ');
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Message syntax:
|
||||
* separator: ~
|
||||
|
Loading…
Reference in New Issue
Block a user