To append a string at the end of another string in Swift, you can use the +
operator or the +=
operator. Here's an example:
main.swift90 chars5 lines
In this example, we used the +=
operator to append str2
at the end of str1
.
Alternatively, you can use the +
operator to concatenate two strings and create a new string:
main.swift114 chars5 lines
In this example, we used the +
operator to concatenate str1
and str2
into a new string combinedStr
.
gistlibby LogSnag