should I use str_replace() or is there a better drupal way for that? Some background info:
I'm Building a D7 module that also sends out a message to users of the site.
I want the site maintainers to be able to define the message by using 'tokens' like this:

$string = "hello :username, there is a new node called :nodenodename_with_a_link on the :website"; // defined in the GUI


I could use str_replace to replace those 'tokens' like so:

$find = array(':username', ':nodenodename_with_a_link', ':website');
$replace = array($username, $node, $sitename); // generated form the db
$newstring = str_replace($find, $replace, $string);


But I'm wondering if this is also the correct way to go in Drupal (7)?
You can either create your own tokens in a custom module or use strtr (it's easier for multiple search and replace operations than str_replace).

To see how to create custom tokens and integrate with token module see token_example module in Examples.