String prepend: Difference between revisions

(Added EasyLang implementation)
(→‎sed: add)
Line 1,574:
val s1 = "Hello" + f2() + s //> s1 : String = Hello, World
println(s1); //> Hello, World</syntaxhighlight>
 
=={{header|sed}}==
There are no variables in ''sed'', just two distinct locations for storing a string: The "pattern space" and the "hold space". To prepend a string literal to the pattern space, the <code>s</code> command can be used:
<syntaxhighlight lang="sed">s/^/String Literal/</syntaxhighlight>
To prepend a string literal to the hold space, it needs to be exchanged with the pattern space, before and after the operation:
<syntaxhighlight lang="sed">x
s/^/String Literal/
x</syntaxhighlight>
 
=={{header|Seed7}}==
559

edits