MCPcopy Create free account
hub / github.com/aldostools/webMAN-MOD / replace_char

Function replace_char

include/init/string.h:169–174  ·  view source on GitHub ↗

static char *replace(char *text, const char *rep, const char *with, int count) { if (!text || !rep || !with || !rep[0]) return text; const int len_with = strlen(with); const int gap = len_with - strlen(rep); char *pos = strstr(text, rep); while (pos) { if(--count == -1) return text; // replace all if count < 0 if(gap > 0) memmove(pos + gap, pos, strlen(pos) + 1); if(gap >= 0)

Source from the content-addressed store, hash-verified

167}
168*/
169static void replace_char(char *text, char c, char r)
170{
171 if(!text) return;
172
173 for( ; *text; text++) if(*text == c) *text = r;
174}
175
176static char *trim(char *title)
177{

Callers 9

get_sys_infoFunction · 0.85
folder_listingFunction · 0.85
faster_findFunction · 0.85
www_client.hFile · 0.85
mount.hFile · 0.85
mount_misc.hFile · 0.85
parse_scriptFunction · 0.85
show_progressFunction · 0.85
add_title_idFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected