String concatenation: Difference between revisions

Add Ecstasy example
(Add Uxntal)
(Add Ecstasy example)
Line 773:
b$ = a$ & " world"
print b$</syntaxhighlight>
 
=={{header|Ecstasy}}==
<syntaxhighlight lang="ecstasy">
module StringAppend {
void run() {
String start = "hello";
String finish = " world";
 
// approach #1: add strings together
String approach1 = start + finish;
 
// approach #2: StringBuffer
String approach2 = new StringBuffer()
.append(start)
.append(finish)
.toString();
 
// approach #3: string template
String approach3 = $"{start}{finish}";
 
@Inject Console console;
console.print($|
|Appending strings:
|
| {start=}
| {finish=}
|
| {approach1=}
| {approach2=}
| {approach3=}
|
);
}
}
</syntaxhighlight>
 
{{out}}
<pre>
x$ xec doc/examples/StringAppend
 
Appending strings:
 
start=hello
finish= world
 
approach1=hello world
approach2=hello world
approach3=hello world
</pre>
 
=={{header|Ela}}==
162

edits