Skip to content

Instantly share code, notes, and snippets.

@pashazz
Created October 6, 2014 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pashazz/4bc845f91186f45cbbba to your computer and use it in GitHub Desktop.
Save pashazz/4bc845f91186f45cbbba to your computer and use it in GitHub Desktop.
void numbersToBinary(string &src)
{
for (string::iterator iter = src.begin(); iter != src.end(); iter++)
{
if (isdigit(*iter))
{
string::iterator numberStart = iter++; //numberStart = iter;
while (src.end() != iter && (isdigit(*iter)))
{
iter++;
}
string ins = decimalToBinary(string(numberStart, iter));
src.replace(numberStart, iter, ins);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment