Things to do:
=============
-- String: Implement String != regex operator
- String: index and rindex methods with String argument
- String: format operator % like in python
- String: assign fstream objects to read and write a file
friend bool operator == (const String &s, const regex &r);
friend bool operator == (const regex &r, const String &s);
- // TODO: The != operator
+ friend bool operator != (const String &s, const regex &r);
+ friend bool operator != (const regex &r, const String &s);
SuperString split(const String &separator);
friend bool operator == (const String &s, const regex &r);
friend bool operator == (const regex &r, const String &s);
+ friend bool operator != (const String &s, const regex &r);
+ friend bool operator != (const regex &r, const String &s);
};
class SuperString
{
return regexec(&r.expression, s.p->s, 0, 0, 0) == 0;
}
+
bool operator == (const regex &r, const String &s)
{
return regexec(&r.expression, s.p->s, 0, 0, 0) == 0;
}
+bool operator != (const String &s, const regex &r)
+{
+ return regexec(&r.expression, s.p->s, 0, 0, 0) != 0;
+}
+
+bool operator != (const regex &r, const String &s)
+{
+ return regexec(&r.expression, s.p->s, 0, 0, 0) != 0;
+}
+
substring String::operator()(const regex &r)
{
substring sub;
assert((s1 == nr) == false);
assert((s2 == nr) == true);
+ assert((s1 != nr) == true);
+ assert((s2 != nr) == false);
+
// Select a substring with a regex
String match;