AppDynamics IoT C++ SDK
AppDynamics IoT C++ library contains code that facilitates capturing availability, usage, network performance and errors of an IoT Application.
utils.cpp File Reference
#include "utils.hpp"
#include "log.hpp"

Functions

std::string appd_iot_remove_character (const char *input, char c)
 Removes a given character from the input string. More...
 

Function Documentation

◆ appd_iot_remove_character()

std::string appd_iot_remove_character ( const char *  input,
char  c 
)

Removes a given character from the input string.

Parameters
inputcontains input string
ccontains the character that needs to be removed from input string.
Returns
new string formed by removing character c from input string. If the input string doesn't contain character c, output string will be same as input string.
28 {
29  std::string output;
30  bool flag = false;
31 
32  if (input == NULL)
33  {
34  return output;
35  }
36 
37  for (size_t i = 0; input[i] != '\0'; i++)
38  {
39  if (input[i] == c)
40  {
41  flag = true;
42  continue;
43  }
44 
45  output.append(&(input[i]), 1);
46  }
47 
48  if (flag)
49  {
50  appd_iot_log(APPD_IOT_LOG_WARN, "Removed invalid '|' pipe char from input string: %s", input);
51  }
52 
53  return output;
54 }
void appd_iot_log(appd_iot_log_level_t log_level, const char *format,...)
Reads log message, appends log header and triggers log write callback function.
Definition: log.cpp:89
Definition: appd_iot_def.h:101