title: How to replace a certain character in a string? Preferably a recursive method
body: <p>My dylan::Replace() function supposed to take a string as the parameter, replace the spaces with asterisks ('*') and return a string. The code below is what I have:</p>
  
  <pre><code>#define n 0
  namespace dylan{
      string Replace(string);
  
      string Replace (string s){
          if (s.substr(n)=="")
              cout &lt;&lt; "string is empty \n";
          else
              s.replace(s.begin(),s.end(),' ','*');
          return s;
      }
  }
  
  using namespace dylan;
  
  int main (int argc, char * argv[]){
      string s="a b c";
      string sAfter=Replace(s);
      // some more stuff
  }
  </code></pre>
  
  <p><s>But G++ tells me that within dylan::Replace() there is <code>no matching function for call to std::basic_string&lt;CharT,_Traits,_Alloc&gt;replace(...)</code></s></p>
  
  <p><strong>BONUS POINT:</strong> are there any recursive ways to do the same job (replace a certain character in a string)? </p>
  
  <hr>
  
  <p><strong>QUESTION UPDATED:</strong> I modified and ran the program and it doe not do the job I wanted. Instead it printed asterisks multiple times.</p>