user20355: I've got an array of char* with serial data that I'm trying to remove ':' from. I have tried to iterate through the char*, find and remove any colons but it just comes out as garbage.
  char* espData[15];

  // pull data from serial and tokenize with strtok > feed to espData

  for(int x = 0; x < index-1; x++){
    size_t nullTerm = strlen(espData[x]);
    espData[x][nullTerm - 1] = '\0';
    char* output
    for(size_t i = 0; i < strlen(espData[x]); ++i){
      if(espData[x][i] != ':') output += espData[x][i];
    }
    espData[x] = output;
    Serial.println(espData[x]);
  }

Moving the null character works fine (I wanted to get rid of the last character in every string). Most of the answers I found for general C++ used std::string which we don't have access to.

user22924: You've assumed that a char * is some kind of string object, since you've got the following line of code: output += espData[x][i];, and then later espData[x] = output;
It quite simply doesn't work like that. At best you can point output inside espData[x] and then do some other logic: but your attempt to "accumulate" the correct characters is incorrect.
Please consider the following code instead:
char* espData[15];

for(int x = 0; x < index-1; x++){
    size_t nullTerm = strlen(espData[x]); // Get current length
    char* output = espData[x];            // Start of string
    for (size_t i = 0; i < nullTerm; ++i){
        if(espData[x][i] != ':') {        // If it's NOT a colon
            *output++ = espData[x][i];    // Copy character 'up'
        } // if
                                          // If it WAS a colon, then
                                          // output does NOT get incremented
    } // for
    *output = '\0'; // End string off with NUL
    Serial.println(espData[x]);
} // for


20355: <p>I've got an array of char* with serial data that I'm trying to remove ':' from. I have tried to iterate through the char*, find and remove any colons but it just comes out as garbage.</p>

<pre class="lang-c prettyprint-override"><code>  char* espData[15];

  // pull data from serial and tokenize with strtok &gt; feed to espData

  for(int x = 0; x &lt; index-1; x++){
    size_t nullTerm = strlen(espData[x]);
    espData[x][nullTerm - 1] = '\0';
    char* output
    for(size_t i = 0; i &lt; strlen(espData[x]); ++i){
      if(espData[x][i] != ':') output += espData[x][i];
    }
    espData[x] = output;
    Serial.println(espData[x]);
  }
</code></pre>

<p>Moving the null character works fine (I wanted to get rid of the last character in every string). Most of the answers I found for general C++ used std::string which we don't have access to.</p>
 22924: <p>You've assumed that a <code>char *</code> is some kind of string object, since you've got the following line of code: <code>output += espData[x][i];</code>, and then later <code>espData[x] = output;</code></p>

<p>It quite simply doesn't work like that. At best you can point <code>output</code> inside <code>espData[x]</code> and then do some other logic: but your attempt to "accumulate" the correct characters is incorrect.</p>

<p>Please consider the following code instead:</p>

<pre><code>char* espData[15];

for(int x = 0; x &lt; index-1; x++){
    size_t nullTerm = strlen(espData[x]); // Get current length
    char* output = espData[x];            // Start of string
    for (size_t i = 0; i &lt; nullTerm; ++i){
        if(espData[x][i] != ':') {        // If it's NOT a colon
            *output++ = espData[x][i];    // Copy character 'up'
        } // if
                                          // If it WAS a colon, then
                                          // output does NOT get incremented
    } // for
    *output = '\0'; // End string off with NUL
    Serial.println(espData[x]);
} // for
</code></pre>
