diff --git a/preprocessor/macro/MacroValue.cc b/preprocessor/macro/MacroValue.cc
index b20beb5db8d00392f2a8192a17fd2f76c7b48af7..e5495e222a41e95ba95f9fdd8fa635405acf9c99 100644
--- a/preprocessor/macro/MacroValue.cc
+++ b/preprocessor/macro/MacroValue.cc
@@ -436,3 +436,9 @@ StringMV::in(const MacroValue *array) const throw (TypeError)
 
   return new IntMV(driver, result);
 }
+
+const MacroValue *
+StringMV::length() const throw (TypeError)
+{
+  return new IntMV(driver, value.length());
+}
diff --git a/preprocessor/macro/MacroValue.hh b/preprocessor/macro/MacroValue.hh
index 1097841d9831f9e0c37b5c5e116c6bce691dfbe9..296500c38fd06333ebb7addae84f2c91935571d5 100644
--- a/preprocessor/macro/MacroValue.hh
+++ b/preprocessor/macro/MacroValue.hh
@@ -194,6 +194,7 @@ public:
   /*! The first argument must be a string array. Returns a string array. */
   virtual const MacroValue *append(const MacroValue *array) const throw (TypeError);
   virtual const MacroValue *in(const MacroValue *array) const throw (TypeError);
+  virtual const MacroValue *length() const throw (TypeError);
 };
 
 //! Represents an array in macro language