예제 #1
0
str_list* _std str_copylines(str_list*list, u32t first, u32t last) {
   TStrings lst;
   if (first<=last) {
      str_getstrs(list,lst);
      if (lst.Count())
         if (first>=lst.Count()) lst.Clear(); else {
            if (last>=lst.Count()) last=lst.Max();
            if (++last!=lst.Count()) lst.Delete(last,lst.Count()-last);
            if (first) lst.Delete(0,first);
         }
   }   
   return str_getlist_local(lst.Str);
}
예제 #2
0
str_list* get_keylist(TINIFile  *ini, const char *Section, str_list**values) {
   TStrings lst;
   ini->ReadSectionKeys(Section,lst);
   if (!values) {
      lst.TrimEmptyLines();
   } else {
      TStrings vlst;
      ini->ReadSectionValues(Section,vlst);
      int ii;
      while (ii<=lst.Max()) {
         spstr sk(lst[ii]), sv(vlst[ii]);
         if (!sk.trim().length() && !sv.trim().length())
            { lst.Delete(ii); vlst.Delete(ii); } else ii++;
      }
      *values = str_getlist_local(vlst.Str);
   }
   return str_getlist_local(lst.Str);
}
예제 #3
0
str_list* _std str_settext(const char *text, u32t len) {
   TStrings lst;
   lst.SetText(text,len);
   for (int ii=0;ii<=lst.Max();ii++) lst[ii].trimright();
   return str_getlist_local(lst.Str);
}
예제 #4
0
// split string to items. result must be freed by single free() call
str_list* __stdcall str_split(const char *str,const char *separators) {
   TStrings lst;
   lst.SplitString(str,separators);
   for (int ii=0;ii<=lst.Max();ii++) lst[ii].trim();
   return str_getlist_local(lst.Str);
}