/**
 * Copyright (c) 2023 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "dawnsharedlibs.hpp"

/**
 * Remove all instances of a character from a C-Styled string.
 * 
 * @param string String to remove characters from.
 * @param remove Character to remove.
 */
static inline void stringRemoveAll(char *string, char remove) {
  size_t len = strlen(string);
  size_t i, j;
  
  i = 0;
  while(i < len) {
    char c = string[i];
    if(c != remove) {
      i++;
      continue;
    }

    j = i + 1;
    while(j < len) {
      string[j-1] = string[j];
      j++;
    }
    len--;
  }
}