Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #289 Concatenate two strings

Create the string s by concatenating the strings a and b.

s = a <> b
s = a ++ b
S : constant String := A & B;
(def s (str a b))
#include <iostream>
#include <string>
std::string a{"Hello"};
std::string b{"world"};
auto s = a + b;
string s = a + b;
string s = String.Concat(a,b);
var s = a + b;
var s = '$a$b';
s = a <> b
s = a // b
s := a + b
const s = a + b;
String s = a.concat(b);
String s = a + b;
String s = "%s%s".formatted(a, b);
import java.util.Formatter;
StringBuilder t = new StringBuilder(a);
Formatter f = new Formatter(t);
f.format("%s", b).flush();
String s = t.toString();
val s = a + b
local s = a..b
$s = $a.$b;
s := a + b;
my $s = $a . $b;
s = a + b
s = f'{a}{b}'
s = a + b
let s = a + b;
let s = format!("{}{}", a, b);
s = a & b

New implementation...