The qr_reference_util functions contain various functions for working with QR Reference Numbers.

Normalize

#include <string>

#include <qrinvoice/util/qr_reference_util.hpp>
// ...

std::string normalized_qr_reference = qrinvoice::qr_reference_util::normalize_qr_reference("11 00012 34560 00000 00008 13457");
std::cout << normalized_qr_reference << std::endl;
// prints "110001234560000000000813457"

Format

#include <string>

#include <qrinvoice/util/qr_reference_util.hpp>
// ...

std::string formatted_qr_reference = qrinvoice::qr_reference_util::format_qr_reference("110001234560000000000813457");
std::cout << formatted_qr_reference << std::endl;
// prints "11 00012 34560 00000 00008 13457"

Checksum

#include <qrinvoice/util/qr_reference_util.hpp>
// ...

int checksum = qrinvoice::qr_reference_util::modulo_10_recursive("12345");
std::cout << std::to_string(checksum) << std::endl;
// prints the checksum of 12345 "7"