MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / formatUserHex

Method formatUserHex

app/src/Console/Handler.cpp:406–422  ·  view source on GitHub ↗

* @brief Reformats @a text as spaced byte pairs for byte-oriented display. */

Source from the content-addressed store, hash-verified

404 * @brief Reformats @a text as spaced byte pairs for byte-oriented display.
405 */
406QString Console::Handler::formatUserHex(const QString& text)
407{
408 static QRegularExpression exp("[^0-9A-Fa-f]");
409 QString data = text.simplified().remove(exp);
410
411 QString str;
412 for (int i = 0; i < data.length(); ++i) {
413 str.append(data.at(i));
414 if ((i + 1) % 2 == 0 && i > 0)
415 str.append(" ");
416 }
417
418 while (str.endsWith(" "))
419 str.chop(1);
420
421 return str;
422}
423
424/**
425 * @brief Clears the console text and per-device buffer for the current device.

Callers

nothing calls this directly

Calls 3

lengthMethod · 0.80
removeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected