Skip to content

Commit 2719777

Browse files
committed
String class: removed deep copy on substring method.
Small code cleanup.
1 parent d90fcca commit 2719777

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

cores/arduino/WString.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,6 @@ int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
527527
return found;
528528
}
529529

530-
String String::substring( unsigned int left ) const
531-
{
532-
return substring(left, len);
533-
}
534-
535530
String String::substring(unsigned int left, unsigned int right) const
536531
{
537532
if (left > right) {

cores/arduino/WString.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class String
158158
int lastIndexOf( char ch, unsigned int fromIndex ) const;
159159
int lastIndexOf( const String &str ) const;
160160
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
161-
String substring( unsigned int beginIndex ) const;
161+
String substring( unsigned int beginIndex ) const { return substring(beginIndex, len); };
162162
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
163163

164164
// modification

0 commit comments

Comments
 (0)