extract is_alpha to string.hh

This commit is contained in:
Maxime Coste 2012-09-30 16:23:18 +02:00
parent 801e3eaae2
commit 430765e132
2 changed files with 10 additions and 13 deletions

View File

@ -21,20 +21,9 @@ bool is_blank(char c)
}
template<bool punctuation_is_word = false>
bool is_word(char c);
template<>
bool is_word<false>(char c)
bool is_word(char c)
{
if (c >= '0' and c <= '9')
return true;
if (c >= 'a' and c <= 'z')
return true;
if (c >= 'A' and c <= 'Z')
return true;
if (c == '_')
return true;
return false;
return Kakoune::is_word(c);
}
template<>

View File

@ -119,6 +119,14 @@ String int_to_str(int value);
int str_to_int(const String& str);
std::vector<String> split(const String& str, Character separator);
inline bool is_word(Character c)
{
return (c >= '0' and c <= '9') or
(c >= 'a' and c <= 'z') or
(c >= 'A' and c <= 'Z') or
c == '_';
}
}
namespace std