You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys,
I noticed that the function String::clear() does not behave as expected. According to the name, it should clear the content of a string object, i.e. after this operation an empty String is returned. This works for all string methods except String::c_str(). Here, the content is retained.
Internally, the clear method only sets the length of the string to 0. For c_str(), however, the first character in the internal memory buf would also have to be set to 0 ('\0').
Description:
Hi guys,
I noticed that the function String::clear() does not behave as expected. According to the name, it should clear the content of a string object, i.e. after this operation an empty String is returned. This works for all string methods except String::c_str(). Here, the content is retained.
Internally, the clear method only sets the length of the string to 0. For c_str(), however, the first character in the internal memory buf would also have to be set to 0 ('\0').
Sketch:
Output:
The text was updated successfully, but these errors were encountered: