To concat two string in Rust, we can use the +
operator. To trim the resulting string, we can use the trim()
method on the resulting string. Here's an example:
main.rs170 chars9 lines
In this example, we first define two string variables str1
and str2
. We then concatenate these two strings using the +
operator and store the resulting string in a new variable called result
. Finally, we use the trim()
method to remove any leading or trailing whitespaces from the resulting string.
gistlibby LogSnag