Skip to content
Discussion options

You must be logged in to vote

Found an answer:

uint64_t convertStringToU64(const String _str) 
{
uint64_t result = 0;
for (size_t i = 0; i < _str.length(); i++) 
  {
  char c = _str[i];
  uint8_t value;

       if (c >= '0' && c <= '9') value = c - '0';
  else if (c >= 'A' && c <= 'F') value = 10 + (c - 'A');
  else if (c >= 'a' && c <= 'f') value = 10 + (c - 'a');
  else break;
  
  result = (result << 4) | value;
  }
return result;
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by matthieuweber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant