Skip to content

Commit b606e4d

Browse files
committed
#60 - Implement method is_punctuation
Fixed error on `is_punctuation()` signature in class `CppStringT`.
1 parent 3fd2973 commit b606e4d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpp-strings/cppstrings.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ class CppStringT : public std::basic_string<CharT>
108108
//=== Methods =========================================
109109

110110
//--- is_punctuation ----------------------------------
111-
/** \brief Returns true if a character belongs to ASCII punctuation set. */
112-
inline const bool is_punctuation(const value_type ch) noexcept
111+
/** \brief Returns true if the string contains only one character and if this character belongs to the ASCII punctuation set. */
112+
inline const bool is_punctuation(const MyBaseClass& str) noexcept
113113
{
114-
return _ASCII_PUNCT_DATA.contains(ch);
114+
return str.size == 1 && _ASCII_PUNCT_DATA.contains(str[0]);
115115
}
116116

117117
//--- is_space ----------------------------------------
@@ -126,7 +126,7 @@ class CppStringT : public std::basic_string<CharT>
126126
if (str.size() == 0)
127127
return false;
128128
for (auto& c : str)
129-
if (std::find(str.cbegin(), str.cend(), c) == str.cend())
129+
if (std::find(_ASCII_SEP.cbegin(), _ASCII_SEP.cend(), c) == _ASCII_SEP.cend())
130130
return false;
131131
return true;
132132
}

0 commit comments

Comments
 (0)