what takes more time for the Arduino to process:
this
if(text != "")
text = "";
or this?
text = "";
what takes more time for the Arduino to process:
this
if(text != "")
text = "";
or this?
text = "";
Which takes longer depends on whether the test succeeds, or not.
Far faster would be to quit f**king around with Strings, which you are obviously using, as that is NOT how to compare strings.
PaulS:
Which takes longer depends on whether the test succeeds, or not.Far faster would be to quit f**king around with Strings, which you are obviously using, as that is NOT how to compare strings.
So will it be faster to compare the two strings with string::compare?
No, use character arrays.
Forget that String (capital S) exists on an Arduino. It might cause unexpected behaviour.
sterretje:
No, use character arrays.Forget that String (capital S) exists on an Arduino. It might cause unexpected behaviour.
but it's not ideal for me because I don't know how many characters suppose to be on the string and arrays has constant size
Delta_G:
You have to size the array for the largest possible string. The null terminator tells where the actual string ends.
I think that the most ideal solution for this problem is using a dynamic memory allocated list.
But it's not really necessary for my project.
Not only that, this solution consumes a lot of RAM memory.