This in my view illustrates a common problem when coming to tiddlywiki with knowledge of other programming languages.
It is actually easier to concatenate strings in tiddlywiki than any other language I have come across.
I wonât give an exhaustive proof here but I assert the truth in the above self quote and ask you to keep an open mind and you will start to see this is true.
Of course when, where and what, you wish to concatenate makes it a little more complex and this includes the concatenation of strings, variables, field and tiddler contents.
Your example is concatenating the contents of two tiddlers, and a string .
to provide the result as a parameter.
- The key here is you want to provide a parameter crafted from the concatenation of other values.
In this case I recommend; for a result you wish to use many times use one of following:
- Set widget using the filter parameter on the set widget
- Define a function as in @Mohammad case, the advantage is you can introduce a meaning full name for the result using it many times and itâs definition is clearly stated at the top of your tiddler or as a global function.
- Within a filter you can use the add prefix and suffix operators or the new substitute operator if there is a lot of static text containing values.
- Functions need âjoinâ to return all but the first value but can be used out of the box to obtain the first value which may be a common requirement for some.
If however you wish to concatenate some values once off and inline without making it reusable, I would still consider the above approach for consistency. Otherwise;
- Use the triple curly braces as did @Charlie_Veniot which uses filters
- Use the new backtick parameters form to construct your parameter from variable references or filters.
I have not included the following as there are complications with when and if they are evaluated. Which is nessasary if itâs to be used as a parameter
- `/define macroname()â still usable despite being depricated
- `/procedure procame()â
Both of these above are fine if you simply want to display the result, just not if you want to use them as parameters.
- I believe Exceptions exist, but this is the safest approach to avoid wasting time.
I can give examples of your use case for each of my recommended approaches if asked.
After thought
It is important to note there is no value in tiddlywiki that canât be referenced using filter notation, so learning each of these makes it simple to write functions, filters using triple curly braces and backtick parameters;
- With the advantage in backtick parameters of simple string and variable concatenation