Procházet zdrojové kódy

Add DynamicString::length()

Daniele Bartolini před 12 roky
rodič
revize
94f6bb9baa
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      engine/core/strings/DynamicString.h

+ 9 - 0
engine/core/strings/DynamicString.h

@@ -58,6 +58,9 @@ public:
 	bool				operator==(DynamicString& s);
 	bool				operator==(const char* s);
 
+	// Returns the length of the string.
+	uint32_t			length();
+
 	/// Removes the leading string @a s.
 	/// @note
 	/// The string must start with @a s.
@@ -171,6 +174,12 @@ inline bool DynamicString::operator==(const char* s)
 	return string::strcmp(c_str(), s) == 0;
 }
 
+//-----------------------------------------------------------------------------
+inline uint32_t DynamicString::length()
+{
+	return string::strlen(this->c_str());
+}
+
 //-----------------------------------------------------------------------------
 inline void DynamicString::strip_leading(const char* s)
 {