What is the 'correct' way to add two string values together? For various reasons that I won't go into I have to add 2 string values together and assign to a third string, something like:
B4X:
str1 = "6.50"
str2 = "0"
str3 = str1 + str2
which results in str3 = "6".
Is it necessary to assign the string to doubles and then use numberformat2 to convert the result back to a string, eg
What result do you expect ?
Do you want to do an arithmethic operation or concatenate two strings ?
If you want to do arithmethic operations you should use Doubles.
If you want to concatenate two strings you should use dbl3 = dbl1 & dbl2.
Thanks Klaus. It was an arithmetic operation I wanted so doubles is the way. But just to satisfy my curiosity, how does the string example above give a result of "6"?
I tried it again and looking at the variables I get str3 = 6.5
So I don't know what happens with your project.
But, anyway for me arithmetic operations are done with numbers and not with strings.