How do i search a string for a certain word, then replace that word with something else.

For example:
String sentance="This is an example";
String searchword="is";
String replaceword="was";

What I need to do is be able to search sentance for the string "is" and replace it with the string "was"