String append: Difference between revisions

(→‎sed: add)
Line 1,546:
//> f2 : () => String = <function0>
println(s1 + f2()); //> HelloHello !</syntaxhighlight>
 
=={{header|sed}}==
There are no variables in ''sed'', just two distinct locations for storing a string: The "pattern space" and the "hold space".
* The <code>H</code> command appends the content of pattern space to the hold space.
* The <code>G</code> command appends the content of hold space to the pattern space.
* The <code>N</code> command appends the next input line to the pattern space.
All three commands insert a newline character between both strings during appending. In pattern space, it can be removed afterwards with the <code>s</code> command, like this:
<syntaxhighlight lang="sed">N
s/\n//</syntaxhighlight>
* The <code>s</code> command can also be used to append a string literal to the pattern space:
<syntaxhighlight lang="sed">s/$/String Literal/</syntaxhighlight>
* To append further lines to the output (after the printing of the pattern space), the <code>a</code> command is useful:
<syntaxhighlight lang="sed">a\
one more line\
and another one</syntaxhighlight>
 
=={{header|Seed7}}==
559

edits