We all have to concatenate strings and varibles and you have to admit that it will get ugly very quickly. Luckily someone created a sprint function we know from other programming languages.
It is called APEX_STRING.FORMAT.
Lets jump to the example first:
What would you rather to read and maintain, before or after version?
If you like the before version, you can stop reading. And if you are still here then we can be friends :-)
You can pass up to 20 arguments and you have two options how to reference them. You either use "%s" and then the values are replaced in the same order as you passed them. Or you can use numbers like "%0..19" and reuse them however you need. I usually stick with "%s" unless I need to replace same value multiple times.
There is a nice side effect of this type of concatenation. It is easy to run. Just copy paste the code, replace "!" with nothing, replace "%" with "&" and you can actually execute the query. You can't do it this simple with normal/common method.