# cctype

***

**1. Check if a Character is Alphabetic**

```cpp
#include <cctype>

bool isAlpha(char c) {
  return std::isalpha(c);
}
```

**2. Check if a Character is Numeric**

```cpp
#include <cctype>

bool isNumeric(char c) {
  return std::isdigit(c);
}
```

**3. Check if a Character is White Space**

```cpp
#include <cctype>

bool isWhitespace(char c) {
  return std::isspace(c);
}
```

**4. Check if a Character is a Lowercase Letter**

```cpp
#include <cctype>

bool isLowercase(char c) {
  return std::islower(c);
}
```

**5. Check if a Character is an Uppercase Letter**

```cpp
#include <cctype>

bool isUppercase(char c) {
  return std::isupper(c);
}
```

**6. Check if a Character is a Letter or Digit**

```cpp
#include <cctype>

bool isLetterOrDigit(char c) {
  return std::isalnum(c);
}
```

**7. Check if a Character is a Control Character**

```cpp
#include <cctype>

bool isControlCharacter(char c) {
  return std::iscntrl(c);
}
```

**8. Check if a Character is a Printable Character**

```cpp
#include <cctype>

bool isPrintableCharacter(char c) {
  return std::isprint(c);
}
```

**9. Check if a Character is a Punctuation Mark**

```cpp
#include <cctype>

bool isPunctuationMark(char c) {
  return std::ispunct(c);
}
```

**10. Check if a Character is a Space Character**

```cpp
#include <cctype>

bool isSpaceCharacter(char c) {
  return std::isspace(c);
}
```

**11. Convert a Lowercase Character to Uppercase**

```cpp
#include <cctype>

char toUpper(char c) {
  return std::toupper(c);
}
```

**12. Convert an Uppercase Character to Lowercase**

```cpp
#include <cctype>

char toLower(char c) {
  return std::tolower(c);
}
```

**13. Toggle the Case of a Character**

```cpp
#include <cctype>

char toggleCase(char c) {
  return std::islower(c) ? std::toupper(c) : std::tolower(c);
}
```

**14. Check if a String is Alphabetic**

```cpp
#include <cctype>
#include <string>

bool isAlphabetic(const std::string& str) {
  for (char c : str) {
    if (!std::isalpha(c)) {
      return false;
    }
  }
  return true;
}
```

**15. Check if a String is Numeric**

```cpp
#include <cctype>
#include <string>

bool isNumeric(const std::string& str) {
  for (char c : str) {
    if (!std::isdigit(c)) {
      return false;
    }
  }
  return true;
}
```

**16. Check if a String is Whitespace**

```cpp
#include <cctype>
#include <string>

bool isWhitespace(const std::string& str) {
  for (char c : str) {
    if (!std::isspace(c)) {
      return false;
    }
  }
  return true;
}
```

**17. Check if a String is a Lowercase String**

```cpp
#include <cctype>
#include <string>

bool isLowercase(const std::string& str) {
  for (char c : str) {
    if (!std::islower(c)) {
      return false;
    }
  }
  return true;
}
```

**18. Check if a String is an Uppercase String**

```cpp
#include <cctype>
#include <string>

bool isUppercase(const std::string& str) {
  for (char c : str) {
    if (!std::isupper(c)) {
      return false;
    }
  }
  return true;
}
```

**19. Check if a String is a Letter or Digit String**

```cpp
#include <cctype>
#include <string>

bool isLetterOrDigitString(const std::string& str) {
  for (char c : str) {
    if (!std::isalnum(c)) {
      return false;
    }
  }
  return true;
}
```

**20. Check if a String is a Control Character String**

```cpp
#include <cctype>
#include <string>

bool isControlCharacterString(const std::string& str) {
  for (char c : str) {
    if (!std::iscntrl(c)) {
      return false;
    }
  }
  return true;
}
```

**21. Check if a String is a Printable Character String**

```cpp
#include <cctype>
#include <string>

bool isPrintableCharacterString(const std::string& str) {
  for (char c : str) {
    if (!std::isprint(c)) {
      return false;
    }
  }
  return true;
}
```

**22. Check if a String is a Punctuation Mark String**

```cpp
#include <cctype>
#include <string>

bool isPunctuationMarkString(const std::string& str) {
  for (char c : str) {
    if (!std::ispunct(c)) {
      return false;
    }
  }
  return true;
}
```

**23. Check if a String is a Space Character String**

```cpp
#include <cctype>
#include <string>

bool isSpaceCharacterString(const std::string& str) {
  for (char c : str) {
    if (!std::isspace(c)) {
      return false;
    }
  }
  return true;
}
```

**24. Convert a String to Uppercase**

```cpp
#include <cctype>
#include <string>

std::string toUpper(const std::string& str) {
  std::string result;
  for (char c : str) {
    result += std::toupper(c);
  }
  return result;
}
```

**25. Convert a String to Lowercase**

```cpp
#include <cctype>
#include <string>

std::string toLower(const std::string& str) {
  std::string result;
  for (char c : str) {
    result += std::tolower(c);
  }
  return result;
}
```

**26. Toggle the Case of a String**

```cpp
#include <cctype>
#include <string>

std::string toggleCase(const std::string& str) {
  std::string result;
  for (char c : str) {
    result += std::islower(c) ? std::toupper(c) : std::tolower(c);
  }
  return result;
}
```

**27. Remove All Non-Alphabetic Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeNonAlphabeticCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isalpha(c)) {
      result += c;
    }
  }
  return result;
}
```

**28. Remove All Non-Numeric Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeNonNumericCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isdigit(c)) {
      result += c;
    }
  }
  return result;
}
```

**29. Remove All White Space Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeWhitespaceCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::isspace(c)) {
      result += c;
    }
  }
  return result;
}
```

**30. Remove All Lowercase Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeLowercaseCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::islower(c)) {
      result += c;
    }
  }
  return result;
}
```

**31. Remove All Uppercase Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeUppercaseCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::isupper(c)) {
      result += c;
    }
  }
  return result;
}
```

**32. Remove All Letter or Digit Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeLetterOrDigitCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::isalnum(c)) {
      result += c;
    }
  }
  return result;
}
```

**33. Remove All Control Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeControlCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::iscntrl(c)) {
      result += c;
    }
  }
  return result;
}
```

**34. Remove All Printable Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removePrintableCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::isprint(c)) {
      result += c;
    }
  }
  return result;
}
```

**35. Remove All Punctuation Marks from a String**

```cpp
#include <cctype>
#include <string>

std::string removePunctuationMarks(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::ispunct(c)) {
      result += c;
    }
  }
  return result;
}
```

**36. Remove All Space Characters from a String**

```cpp
#include <cctype>
#include <string>

std::string removeSpaceCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (!std::isspace(c)) {
      result += c;
    }
  }
  return result;
}
```

**37. Replace All Non-Alphabetic Characters with a Space**

```cpp
#include <cctype>
#include <string>

std::string replaceNonAlphabeticCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isalpha(c)) {
      result += c;
    } else {
      result += ' ';
    }
  }
  return result;
}
```

**38. Replace All Non-Numeric Characters with a Zero**

```cpp
#include <cctype>
#include <string>

std::string replaceNonNumericCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isdigit(c)) {
      result += c;
    } else {
      result += '0';
    }
  }
  return result;
}
```

**39. Replace All White Space Characters with a Newline**

```cpp
#include <cctype>
#include <string>

std::string replaceWhitespaceCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isspace(c)) {
      result += '\n';
    } else {
      result += c;
    }
  }
  return result;
}
```

**40. Replace All Lowercase Characters with a Uppercase Character**

```cpp
#include <cctype>
#include <string>

std::string replaceLowercaseCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::islower(c)) {
      result += std::toupper(c);
    } else {
      result += c;
    }
  }
  return result;
}
```

**41. Replace All Uppercase Characters with a Lowercase Character**

```cpp
#include <cctype>
#include <string>

std::string replaceUppercaseCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isupper(c)) {
      result += std::tolower(c);
    } else {
      result += c;
    }
  }
  return result;
}
```

**42. Replace All Letter or Digit Characters with a Star**

```cpp
#include <cctype>
#include <string>

std::string replaceLetterOrDigitCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::isalnum(c)) {
      result += '*';
    } else {
      result += c;
    }
  }
  return result;
}
```

**43. Replace All Control Characters with a Null Character**

```cpp
#include <cctype>
#include <string>

std::string replaceControlCharacters(const std::string& str) {
  std::string result;
  for (char c : str) {
    if (std::iscntrl(c)) {
      result += '\0';
    } else {
      result += c;
    }
  }
  return result;
}
```

**44. Replace All Printable Characters with a Backspace Character**

```cpp
#include <cctype>
#include <string>

std::string replacePrintableCharacters(const std::string& str) {
  std::string result;


```
