1 #include "bitcoinaddressvalidator.h"
5 /* Base58 characters are:
6 "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
9 - All numbers except for '0'
10 - All uppercase letters except for 'I' and 'O'
11 - All lowercase letters except for 'l'
13 User friendly Base58 input can map
18 BitcoinAddressValidator::BitcoinAddressValidator(QObject *parent) :
23 QValidator::State BitcoinAddressValidator::validate(QString &input, int &pos) const
26 for(int idx=0; idx<input.size(); ++idx)
28 switch(input.at(idx).unicode())
32 input[idx] = QChar('1');
36 input[idx] = QChar('o');
44 QValidator::State state = QValidator::Acceptable;
45 for(int idx=0; idx<input.size(); ++idx)
47 int ch = input.at(idx).unicode();
49 if(((ch >= '0' && ch<='9') ||
50 (ch >= 'a' && ch<='z') ||
51 (ch >= 'A' && ch<='Z')) &&
52 ch != 'l' && ch != 'I' && ch != '0' && ch != 'O')
54 /* Alphanumeric and not a 'forbidden' character */
58 state = QValidator::Invalid;