types.String.concat
Method on every
stringJoins its arguments into one string, with str between each pair.
The binding carries no declaration string, so the VM cannot report parameter names. The names above are from this page; the types and attributes still come from the VM. The VM also cannot tell an optional parameter from a variadic tail here, so read the brackets and any trailing
... from the prose below, not from the signature.let separator = ", "
println("separator.concat(\"sword\", \"shield\", \"potion\") =", separator.concat("sword", "shield", "potion"))Output:
separator.concat("sword", "shield", "potion") = sword, shield, potionParameters
value | any | the first item to join |
... | any | further items to join repeats |
Return value
value and the rest, each converted with tostring(), joined with str between each pair. An item can be any type, not only a string.
Notes
Takes 1 or more arguments: at least one item is required. This is a real, unbounded vararg - unlike types.String.join, which takes its items from an array and caps itself at one extra argument, concat takes the items directly as arguments and accepts any number of them.
Example
// items can be any type: each is converted with tostring().
println("\"-\".concat(1, \"b\", true) =", "-".concat(1, "b", true))
println("\"-\".concat(\"solo\") =", "-".concat("solo"))Output:
"-".concat(1, "b", true) = 1-b-true
"-".concat("solo") = soloSee also
join | Joins the items of arr into one string, with str between each pair. |
subst | Substitutes {0}, {1}, ... and {name} placeholders in str with the given values. |
| string | class index |