Having a lot of string building statement, I was asking myself what is the best way to handle that, from a performance and memory handling perspective:
B4X:
newstring = "constant string" & variablestring
or
B4X:
newstring = $"constant string${variablestring}"$
both produce the same result, but which one generates the best code and runtime performance?
Not sure about what I am about to write, but...
Regular string are Immutable.
So trying to modify it will, with a concatenation with & for example, anyway create an additional new string.
To avoid this it should be used the StringBuilder that will manage mutable string and will effectively reuse the same string.
Here the documentation: https://www.b4x.com/android/help/core.html#stringbuilder