diff --git a/astring.h b/astring.h index a32f86c..b519db0 100644 --- a/astring.h +++ b/astring.h @@ -30,6 +30,15 @@ class Astr Astr(const char* string); ~Astr(); + + int length(){ return *m_length; } + + // Returns length including terminator + int lengthT(){ return *m_lengthT; } + + // Synonyms for length + int size(){ return length(); } + int sizeT(){ return lengthT(); } }; #endif diff --git a/examples/Test/Test.ino b/examples/Test/Test.ino index cd05998..4b56a52 100644 --- a/examples/Test/Test.ino +++ b/examples/Test/Test.ino @@ -11,9 +11,11 @@ void setup() { Serial.begin(9600); - // charAt(); Astr s1 = Astr("Hello, World"); + // Length + testCond("length()", s1.length() == 12); + testCond("lengthT()", s1.lengthT() == 13); } void loop() {}