56 std::string num = str;
59 while (num.size() > 0 && num != std::string(
"0"))
61 char last = num[num.size() - 1];
62 if (std::string::npos != odds->find(last))
69 for (
size_t i = 0; i < num.size(); i++)
71 char ch = (num[i] -
'0') / 2 + add;
72 new_num += (ch +
'0');
73 if (std::string::npos != odds->find(num[i]))
83 size_t first_non_zero = 0;
84 while (first_non_zero < new_num.size() - 1 && new_num[first_non_zero] ==
'0')
89 if (first_non_zero > 0 && first_non_zero <= new_num.size() - 1)
91 new_num = new_num.substr(first_non_zero);
97 if (pos >=
LC_WIDTH && num.size() > 0 && num != std::string(
"0"))
99 throw std::overflow_error(std::string(
"LinguisticCode::fromDecString: input string is too long: ") + str);