Logo

Programming-Idioms

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

Idiom #289 Concatenate two strings

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

let s = format!("{}{}", a, b);

This allocates a new String with a and b concatenated.
let s = a + b;

This adds b to the current allocation of a, meaning that a needs to be a mutable String.
S : constant String := A & B;

New implementation...