String concatenation failure

The following formula:

":"+"004"

returns the string

":4"

All zeros are gone. What happened? Meanwhile, I use the workaround:

Format(":{1}","004")

Hmm when I use concatenate and 004 it displays :004 without problem. Can you post your concatenate formula? It might be because you are using + instead of ,.

This Concatenate(":","004") gives :004

You could also use :blush: :

Format(":{1:000}","4")

(as it also gives :004)

As far as I know though, using "some text"+"some text" as always seemed a little bit hacky and can lead to β€œerrors” where Concatenate() has always been reliable :blush:.

Yes I was using actually ":"+Format(":{1:000}", "4") but same problem as above. I use the +. With Concat, the problem goes aways. Still, what is the rule for + ?
β€œ:”+β€œ004” = β€œ:4”
β€œ:”+β€œ114” = β€œ:114”
β€œ:”+β€œ224” = β€œ:224”
…

To be honest, I have no idea why the 00 is not recognized here when using "something" + "something" but I guess, the β€œrule” would be to solely use either Concatenate("Text 1","Text 2") or Format() and avoid using + "something" :innocent:.

2 Likes

The + is like concatenate() but not exactly because it can also do maths (addition). Because of this, it tries to do math on things and appears to be treating your β€œ004” as an integer; since 004 = 4 as an integer, it drops the preceding zeroes. concat(), concatenate() and format() are great ways to get around this nuance.

1 Like