Skip to content

Commit 4b0c706

Browse files
committed
#21 - Implement method CppStringT::isalnum()
Completed.
1 parent 14054fb commit 4b0c706

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

cpp-strings/cppstrings.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
//=============================================================
2424
#include <algorithm>
2525
#include <cctype>
26+
#include <cwctype>
2627
#include <format>
2728
#include <span>
2829
#include <stdexcept>
@@ -349,6 +350,42 @@ class CppStringT : public std::basic_string<CharT>
349350
}
350351

351352

353+
//--- isalnum() ---------------------------------------
354+
/** \brief Returns true if all characters in the string are alphanumeric and there is at least one character, or false otherwise. */
355+
inline const bool isalnum() const noexcept
356+
{
357+
return this->isalpha() || this->isdecimal() || this->isdigit() || this->isnumeric();
358+
}
359+
360+
361+
//--- isalpha() --------------------------------------
362+
inline const bool isalpha() const noexcept
363+
{
364+
return false;
365+
}
366+
367+
368+
//--- isdecimal() -------------------------------------
369+
inline const bool isdecimal() const noexcept
370+
{
371+
return false;
372+
}
373+
374+
375+
//--- isdigit() ---------------------------------------
376+
inline const bool isdigit() const noexcept
377+
{
378+
return false;
379+
}
380+
381+
382+
//--- isnumeric() -------------------------------------
383+
inline const bool isnumeric() const noexcept
384+
{
385+
return false;
386+
}
387+
388+
352389
//--- is_punctuation() --------------------------------
353390
/** \brief Returns true if the string contains only one character and if this character belongs to the ASCII punctuation set. */
354391
inline const bool is_punctuation() const noexcept

0 commit comments

Comments
 (0)