concatenating strings

I have a set of numbers I was putting into a label, and adding descriptors to them. Example, I have

var i as integer
var j as integer
var s as string
i = 5
j = 12
s = "i: " + i.tostring + " j: " + j.tostring

but I am constantly getting a syntax error on allocating a value to ‘s’

however, if I add each one to it individually, I arrive at the desired result:

s = "l: " + i.tostring
s = s + " j: "
s = s + j.tostring

I feel like there must be a better way.

S = "i: " + i.tostring +_
" j: " + j.tostring

Your code seems legit. Above is almost the same only the “_” line continuation char is added.

I tried on a test application Desktop on Mac… push button action writes the result string s on label.value … It worked :slight_smile: I don’t know what’s wrong with your code . Should work :slight_smile:

I just came back to delete my question, apologies, it must be time to just go to bed…

It turns out (in as far as I can tell) that I had embedded a non printable character inbetween some of the plus signs. It’s something that get’s me every now and then because I haven’t programmed my desktop for the xojo IDE. I have “shift+space” customised to be a non breaking space in my xmodmap. I’m usually aware of it, but when it comes to app development (on this particular machine) I occasionally forget about it. Because there were so many spaces in those lines of code and shifted characters immediately before or after, they kept slipping in. Once I broke it down line by line and entered it slowly, it worked…

Changing xmodmap now :stuck_out_tongue:

xmodmap -pke ... keycode 65 = space nobreakspace space nobreakspace ...