Extract hexDump function

This commit is contained in:
Fabian Müller 2024-04-12 03:21:41 +02:00
parent 852932a934
commit 7f7959778c

View File

@ -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: ~