NTMDev
(Professional Developer/Programmer )
June 19, 2025, 8:03pm
1
I’m not sure if this will be useful, but is it possible to concatenate strings?
(example) Java:
String a = "Hi";
String b = "Hi #2";
String c = a + b;
Output: "HiHi #2"
If so, is there a placeholder for strings, so a string can become more dynamic?
(example) Java:
String name = "DesmosCL";
String formattedName = String.format("Hi Name: %s", name);
Output: Hi Name: DesmosCL
(I’m not planning on to use this really, just a curious thought)
@Daniel_Grubbs
Sure but you don’t need a concatenate function, you just treat strings as partials and interpolate:
String a = "Hi"
String b = "Hi #2"
String c = "${a}${b}"
Output: HiHi #2
I do it all the time, very useful!
NTMDev
(Professional Developer/Programmer )
June 20, 2025, 12:57am
3
Oh so ${}
isn’t only for numerics?
${}
can be used to insert any appropriate variable input. You can even insert conditionals:
suffix = "inch${
when numericValue(`\abs(${this.numericValue})`) = 1 ""
otherwise "es"}"
… which would show “inch” for 1 or -1, and “inches” otherwise.
I think the most common use though is something simple, similar to @Mike_Gleeson 's, maybe from a different screen:
feedback = "Your answer was ${input1.numericValue}."
NTMDev
(Professional Developer/Programmer )
June 20, 2025, 6:13pm
5
That’s cool! I didn’t know the placeholder was so versatile! It would be a lot more efficient if other coding languages allowed you to insert an if
condition directly into a string…