...

/

Updating a String

Updating a String

This lesson will teach to update a string in Rust.

An existing string can be updated by appending a character or a string.

💡 Why not make a new String rather than updating an existing one?

Updating an existing String is useful when you want to make changes to an existing String at run time rather than compile one like, in situations where changes are made to the String on a condition.

Push a Single Character

There are cases when it is required to update a string by pushing a single character. One example is ...