|
|
|
@ -467,6 +467,39 @@ char *yon_cut(char *source, int size, int startpos)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_char_wrap_to_lines(char *target, unsigned int line_count, unsigned int *final_size){
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(target)&&line_count){
|
|
|
|
|
|
|
|
(*final_size)=0;
|
|
|
|
|
|
|
|
unsigned int spaces = yon_char_find_count(target," ");
|
|
|
|
|
|
|
|
float line_spaces = (float)spaces/line_count;
|
|
|
|
|
|
|
|
float left = spaces%line_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int processed=0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(target,&size," ");
|
|
|
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
|
|
|
for (int i=0;i<line_count;i++){
|
|
|
|
|
|
|
|
char *final_str = NULL;
|
|
|
|
|
|
|
|
for (int j=0;j<(int)line_spaces+left?1:0;j++){
|
|
|
|
|
|
|
|
if (processed>spaces+1) break;
|
|
|
|
|
|
|
|
if (final_str){
|
|
|
|
|
|
|
|
char *temp = yon_char_unite(final_str," ",parsed[processed],NULL);
|
|
|
|
|
|
|
|
free(final_str);
|
|
|
|
|
|
|
|
final_str = temp;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
final_str = parsed[processed];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
processed++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (left) left--;
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(final,final_size,final_str);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return final;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_char_divide(char *source, int dividepos)
|
|
|
|
char *yon_char_divide(char *source, int dividepos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (source&&strlen(source)>=dividepos){
|
|
|
|
if (source&&strlen(source)>=dividepos){
|
|
|
|
@ -489,13 +522,10 @@ int yon_char_find_count(char *source, char *find){
|
|
|
|
int i=0;
|
|
|
|
int i=0;
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
int pos=0;
|
|
|
|
int pos=0;
|
|
|
|
config_str rtn = yon_char_parse(working_string,&size,"\n");
|
|
|
|
config_str rtn = yon_char_parse(working_string,&size,find);
|
|
|
|
free(working_string);
|
|
|
|
free(working_string);
|
|
|
|
for (int j=0;j<size;j++){
|
|
|
|
yon_char_parsed_free(rtn,size);
|
|
|
|
if(strstr(rtn[j],find))
|
|
|
|
return size-1;
|
|
|
|
i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int yon_char_count(char *source, char *find){
|
|
|
|
int yon_char_count(char *source, char *find){
|
|
|
|
|