Troll String Concatenation

Troll String Concatenation

Return to topic list

Wed Sep 13 17:46:02 2017   by   wyrdR
Hi Torben,

I regularly come up against the issue that the || operator combines text but with spaces between each string.  E.g. 4 th instead of 4th;  8 . 0 1  if I mean 8.01.

If practical, please consider making a ++ or && or similar operator to allow for two strings to be joined without spaces, or maybe altering the existing || operator.

Thanks for in advance whatever the response,

wyrdR

 
Thu Sep 14 10:15:40 2017   by   Torben
The || operator does not add space (try writing "4" || "th").  Can you give me a concrete example where you experience the problem?
 
Fri Sep 15 06:56:03 2017   by   wyrdR
Right you are!

It's the numbers themselves; they are right-padded by a white space.

E.g.

x:=d10;'x||if x>3 then "th" else if x=3 then "rd" else if x=2 then "nd" else "st"

Some results:

7 th
2 nd
3 rd
9 th
10 th
8 th


 
Fri Sep 15 06:57:44 2017   by   wyrdR
Maybe the ' expression could trim the trailing white space ?
 
Fri Sep 15 10:47:01 2017   by   Torben
It is fixed now
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list