char to String to char conversion

Think you better use an in place replace command for char[]'s,

The replace function below replaces every occurence of "from" with "to" in the source string but only if the "to" string is shorter or equal than the "from" string.

(not tested thoroughly)

// 
//    FILE: replace.pde
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.00
// PURPOSE: in place replace in a char string.
//
// HISTORY: 
// 0.1.00 - 2011-05-13  initial version
// 
// Released to the public domain
//

char in[128] = "String(newsString).replace(&amp39;with something else&amp39;);";

void replace(char* source, char* from, char* to)
{
  uint8_t f = strlen(from);
  uint8_t t = strlen(to);
  char *p = source;

  if (t> f) return;
  while (*p != '\0')
  {
    if (strncmp(p, from, f) == 0)
    {
      strncpy(p, to, t);
      p += t;
      strcpy(p, p+f-t);
    }
    else p++;
  }
}

void setup()
{
  Serial.begin(115200);
  Serial.println("Start");
  Serial.println(in);

  unsigned long t1 = micros();
  replace(in, "&amp39;", "\'");
  Serial.println(micros() - t1);

  Serial.println(in);
  replace(in, "ing", "ong");
  Serial.println(in);
}

void loop(){}