|
|
|
|
@ -662,6 +662,26 @@ char *yon_char_replace(char *source, char *find, char*replace){
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *yon_char_replace_single(char *source, char *find, char *replace){
|
|
|
|
|
if (!yon_char_is_empty(source)&&!yon_char_is_empty(find)){
|
|
|
|
|
char *current = NULL;
|
|
|
|
|
if ((current=strstr(source,find))){
|
|
|
|
|
int size = sizeof(char)*(strlen(source)-strlen(find)+strlen(replace)+1);
|
|
|
|
|
int replace_pos = strlen(source)-strlen(find);
|
|
|
|
|
char *final = malloc(size);
|
|
|
|
|
memset(final,0,size);
|
|
|
|
|
memcpy(final,source,replace_pos);
|
|
|
|
|
memcpy(final+replace_pos,replace,strlen(replace));
|
|
|
|
|
if (strlen(source+replace_pos)>strlen(find)){
|
|
|
|
|
memcpy(final+strlen(final),source+strlen(find),strlen(source+strlen(find)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return final;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char **yon_char_parse(char *parameters, int *size, char *divider){
|
|
|
|
|
*size=0;
|
|
|
|
|
if (parameters){
|
|
|
|
|
|