#endif
//#include <cstring>
-#include <cctype>
+//#include <cctype>
#include "Lsstream.h"
///
int compare_no_case(string const & s, string const & s2);
+///
+int compare_ascii_no_case(string const & s, string const & s2);
+
///
int compare_no_case(string const & s, string const & s2, unsigned int len);
inline
int compare(char const * a, char const * b)
{
+#ifndef CXX_GLOBAL_CSTD
return std::strcmp(a, b);
+#else
+ return strcmp(a, b);
+#endif
}
///
inline
int compare(char const * a, char const * b, unsigned int len)
{
+#ifndef CXX_GLOBAL_CSTD
return std::strncmp(a, b, len);
+#else
+ return strncmp(a, b, len);
+#endif
}
///
///
double strToDbl(string const & str);
-///
+///
char lowercase(char c);
-///
+///
char uppercase(char c);
///
/// convert \a T to string
template<typename T>
inline
-string const tostr(T const & t)
+string const tostr(T const & t)
{
ostringstream ostr;
ostr << t;
///
bool contains(char const * a, char const * b);
+/// This should probably we rewritten to be more general.
+class contains_functor {
+public:
+ typedef string first_argument_type;
+ typedef string second_argument_type;
+ typedef bool result_type;
+
+ bool operator()(string const & haystack, string const & needle) const {
+ return contains(haystack, needle);
+ }
+};
+
+
///
bool containsOnly(string const &, char const *);
///
bool containsOnly(char const *, string const &);
-/// Counts how many of character c there is in a
-string::size_type countChar(string const & a, char c);
-
/** Extracts a token from this string at the nth delim.
Doesn't modify the original string. Similar to strtok.
Example:
/** Search a token in this string using the delim.
Doesn't modify the original string. Returns -1 in case of
- failure.
+ failure.
Example:
\code
"a;bc;d".tokenPos(';', "bc") == 1;
/// Same as split but uses the last delim.
string const rsplit(string const & a, string & piece, char delim);
+/// Escapes non ASCII chars
+string const escape(string const & lab);
+
#endif