diff --git a/doc/src/manual/faq.md b/doc/src/manual/faq.md index 745c8f2e17dfc..f9d4306374f88 100644 --- a/doc/src/manual/faq.md +++ b/doc/src/manual/faq.md @@ -593,6 +593,17 @@ julia> remotecall_fetch(anon_bar, 2) 1 ``` +### Why does Julia use `*` for string concatenation? Why not `+` or something else? + +The [main argument](@ref man-concatenation) against `+` is that string concatenation is not +commutative, while `+` is generally used as a commutative operator. While the Julia community +recognizes that other languages use different operators and `*` may be unfamiliar for some +users, it communicates certain algebraic properties. + +Note that you can also use `string(...)` to concatenate strings (and other values converted +to strings); similarly, `repeat` can be used instead of `^` to repeat strings. The +[interpolation syntax](@ref string-interpolation) is also useful for constructing strings. + ## Packages and Modules ### What is the difference between "using" and "import"? diff --git a/doc/src/manual/strings.md b/doc/src/manual/strings.md index 77f1e48c5f689..09b67c4fa3ff2 100644 --- a/doc/src/manual/strings.md +++ b/doc/src/manual/strings.md @@ -350,7 +350,7 @@ further discussion of UTF-8 encoding issues, see the section below on [byte arra The [`transcode`](@ref) function is provided to convert data between the various UTF-xx encodings, primarily for working with external data and libraries. -## Concatenation +## [Concatenation](@id man-concatenation) One of the most common and useful string operations is concatenation: