1. ## Problem with function.

The function should return true if the string only contains hexadecimal chars. However it keeps returning true not matter what the input is,
Code:
```inline bool hex(string String, int Lenght)
{
// Integer that will have a value of 1 if a number is found.
int FoundHex = 1;
// The set of special characters
string Hex = "abcdefABCDEF012345689";

// When the counter is less or equals to the lenght of the string and no special character has been found go to the next string index.
for(int counter = 0; counter <= Lenght && FoundHex != 1; counter++)
{
// Integer to hold the lenght of the string containing our specials.
int HexSize = Hex.size();

// Loop through all our special characters.
for( int Scounter = 0; Scounter < HexSize; Scounter++)
{
// When the current special character does not matches the location we are pointing to of our string set FoundSpecial to 0.
if(String[counter] != Hex[Scounter])
{
FoundHex = 0;
}
}
}

// Return result.
if(FoundHex == 1)
{
return true;
}
else
{
return false;
}
}```

2. FoundHex should be a bool, not an int. Once you detect a non-hex character, set it to false, then break from the loop.

By the way, counter <= Lenght should be counter < Lenght. Actually, Lenght should be Length.

Also, take a look at some of the member functions of std::string. They can help you simplify your code.

3. Thanks. I overlooked a function. Got it to work like this.
Code:
```inline bool hex(string String, int Lenght)
{
// Go through the string
for(int counter = 0; counter < Lenght; counter++)
{
// See if at the current location in the string (pointed to by the counter) there is NOT a hex  number,
if(!isxdigit(String[counter]))
{
// If NOT a hex number return false.
return false;
}
}
// Otherwise return true.
return true;
}```

4. Good to hear. Based on your earlier idea, this is another way of doing it:
Code:
```inline bool isHex(const string& str)
{
return str.find_first_not_of("abcdefABCDEF012345689") == string::npos;
}```

5. I will bookmark this page. I do not fully understand what you did there but it seems like a good way to optimize my code so I will look into it later when I understand C++ a bit better.

Just coding my first program ever.