feat: Allow pasting of bytes with prefixes and comma separators

Closes #581
This commit is contained in:
WerWolv 2022-12-29 15:08:36 +01:00
parent 6e8d3e0d7f
commit 696d8d1d54
1 changed files with 5 additions and 0 deletions

View File

@ -630,6 +630,11 @@ namespace hex::plugin::builtin {
if (clipboard.empty())
return;
// Remove common hex prefixes and commas
hex::replaceStrings(clipboard, "0x", "");
hex::replaceStrings(clipboard, "0X", "");
hex::replaceStrings(clipboard, ",", "");
// Check for non-hex characters
bool isValidHexString = std::find_if(clipboard.begin(), clipboard.end(), [](char c) {
return !std::isxdigit(c) && !std::isspace(c);