MudOSa4DGD/
MudOSa4DGD/bin/
MudOSa4DGD/data/
MudOSa4DGD/doc/
MudOSa4DGD/doc/driver/
MudOSa4DGD/doc/efun/bitstrings/
MudOSa4DGD/doc/efun/command/
MudOSa4DGD/doc/efun/communication/
MudOSa4DGD/doc/efun/heart_beat/
MudOSa4DGD/doc/efun/interactive/
MudOSa4DGD/doc/efun/inventory/
MudOSa4DGD/doc/efun/living/
MudOSa4DGD/doc/efun/mappings/
MudOSa4DGD/doc/efun/strings/
MudOSa4DGD/doc/efun/uid/
MudOSa4DGD/doc/funs/
MudOSa4DGD/doc/language/
MudOSa4DGD/mudlib/dgd/doc/
MudOSa4DGD/mudlib/dgd/lib/include/dgd/
MudOSa4DGD/mudlib/dgd/lib/std/
MudOSa4DGD/mudlib/dgd/lib/sys/
MudOSa4DGD/mudlib/dgd/log/
MudOSa4DGD/mudlib/log/
MudOSa4DGD/mudlib/std/include/
MudOSa4DGD/mudlib/std/obj/
/*                                                                            
 * big_explode.c  
 *                                                         
 * Opposite of implode()
 *                                                               
 * (C) Frank Schmidt, Jesus@NorseMUD                             
 *                                                                
 */   


/* big_explode(str, separator)
   This function works like explode(), except that it also counts
   separators at the start and end of the string. Basically that means
   that the array returned is more practical to parse. Explode is found
   3-4 times faster than using sscanf, which is over 10 times faster 
   using the needed functions coded in pure LPC.
*/
static string *big_explode(string str, string sep) {
  int stlen, seplen;
  string *expl;
  expl = ::explode(str, sep);
  /*return expl;*/
  if ((stlen=strlen(str)) > (seplen=strlen(sep)) && seplen > 0) {
    if (str[..seplen-1] == sep)
      /* matching separator found at beginning */
      expl = ({ "" }) + expl;
    if (str[stlen-seplen..] == sep && ::sizeof(expl - ({ "" })))
      /* matching separator found at end */
      expl += ({ "" });
  }
  /* got correct array now, return */
  return expl;
}


/* big_implode(str, separator)
   fully implodes an array of strings, regaining the string from
   big_explode(), unlike the relation between explode() and implode()
*/
static string big_implode(string *arr, string sep) {
  if (!::sizeof(arr - ({ "" }))) {
    /* special array consisting only of separators, add one extra */
    arr += ({ "" });
  }
  return ::implode(arr, sep);
}