Delimiter-related utils
770257
function memoize(key, val) {
  if (cache.hasOwnProperty(key)) {
    return cache[key];
  }
  return (cache[key] = val);
}
350987
public static String joiningWithDelimiter(CharSequence delimiter,
            List<String> stringList) {
        return joiningWith(stringList.stream(), delimiter);
    }
615715
function (delimiter, string, limit) {

            if (arguments.length < 2 ||
                typeof delimiter === "undefined" ||
                typeof string === "undefined"
            ) {
                return null;
            }

            if (delimiter === "" ||
                delimiter === false ||
                delimiter === null
            ) {
                return false;
            }

            if (delimiter === true) {
                delimiter = "1";
            }

            // Here we go...
            delimiter += "";
            string += "";

            var splited = string.split(delimiter);

            if (typeof limit === "undefined") {
                return splited;
            }

            // Support for limit
            if (limit === 0) {
                limit = 1;
            }

            // Positive limit
            if (limit > 0) {
                if (limit >= splited.length) {
                    return splited;
                }

                return splited.slice(0, limit - 1)
                    .concat([splited.slice(limit - 1)
                        .join(delimiter)
                    ]);
            }

            // Negative limit
            if (-limit >= splited.length) {
                return [];
            }

            splited.splice(splited.length + limit);

            return splited;
        }
716033
public static final List<DelimiterInfo> extractDelimiterList(final String str, final String delimiter) {
        assertStringNotNull(str);
        assertDelimiterNotNull(delimiter);
        final List<DelimiterInfo> delimiterList = new ArrayList<DelimiterInfo>();
        DelimiterInfo previous = null;
        String rear = str;
        while (true) {
            final int beginIndex = rear.indexOf(delimiter);
            if (beginIndex < 0) {
                break;
            }
            final DelimiterInfo info = new DelimiterInfo();
            info.setBaseString(str);
            info.setDelimiter(delimiter);
            final int absoluteIndex = (previous != null ? previous.getEndIndex() : 0) + beginIndex;
            info.setBeginIndex(absoluteIndex);
            info.setEndIndex(absoluteIndex + delimiter.length());
            if (previous != null) {
                info.setPrevious(previous);
                previous.setNext(info);
            }
            delimiterList.add(info);
            previous = info;
            rear = str.substring(info.getEndIndex());
            continue;
        }
        return delimiterList;
    }
313443
private static String delimit(String s, char c) {
    int i = s.indexOf(c);
    while (i != -1) {
      if (i == 0 || s.charAt(i - 1) != '\\') {
        s = s.substring(0, i) + '\\' + s.substring(i);
        i = s.indexOf(c, i + 2);
      } else {
        i = s.indexOf(c, i + 1);
      }
    }
    return s;
  }
243299
def _str(self, indent=""):
        """"""
        if self.ndim <= 1:
            return "[" + ", ".join(str(x) for x in self) + "]"
        elif self.ndim == 2:
            sep = ",\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
        else:
            sep = ",\n\n" + indent
            return "[" + sep.join(x._str(indent + " ") for x in self) + "]"
47510
function (expr, length, fillChar) {
  fillChar = fillChar || ' ';
  var string = '' + expr;
  var totalPad = length - string.length;
  if (string.length > length) {
    return center(string, length);
  } else {
    //if (totalPad > 0) {
      var leftPad = string.length + Math.floor(totalPad / 2);
      string = lpad(string, leftPad, fillChar);
      string = rpad(string, length, fillChar);
    //}
  }
  return string;
}
764092
def parse_utuple(s,urx,length=2):
    ''''''
    if type(urx) != str:
        urx=urx.pattern;
    if length is not None and length < 1:
        raise ValueError("invalid length: {}".format(length));
    if length == 1:
        rx = r"^ *\( *{urx} *,? *\) *$".format(urx=urx);
    elif length is None:
        rx = r"^ *\( *(?:{urx} *, *)*{urx} *,? *\) *$".format(urx=urx);
    else:
        rx = r"^ *\( *(?:{urx} *, *){{{rep1}}}{urx} *,? *\) *$".format(
            rep1=length-1,
            urx=urx);
    return re.match(rx,s);
906200
def delimited(nodes, delimiter = ', ')
      max = nodes.length - 1
      nodes.each_with_index do |element, index|
        element.visit(self)
        append(delimiter) if index < max
      end
      self
    end
1118258
function delimsObject(delims) {
  var a = delims[0], b = delims[1];
  var res = {};
  res.interpolate = lazy.delimiters(a + '=', b);
  res.evaluate = lazy.delimiters(a, b);
  res.escape = lazy.delimiters(a + '-', b);
  return res;
}
163975
function indent(str, prefix) {
  prefix = prefix || '   ';
  var lines = str.split("\n");
  lines.forEach(function(line, i) {
    lines[i] = prefix + line;
  });
  return lines.join("\n");
}
1109
def read_str(delim=',', *lines):
    """"""

    data = []
    for line in lines:
        com = parse_line(line, delim)
        data.append(com)
    return data
463933
def separator_sub_line(cls, sep='-', size=10):
        
        if cls.intty():
            cls.echo("\t" + sep * size)
870905
def __space_delimited_list(value):
    ''''''
    if isinstance(value, six.string_types):
        value = value.strip().split()

    if hasattr(value, '__iter__') and value != []:
        return (True, value, 'space-delimited string')
    else:
        return (False, value, '{0} is not a valid space-delimited value.\n'.format(value))
1035415
function(o, delimit1, delimit2) {
      if (o.join) return o.join(delimit1);  // If it's an array
      var pairs = [];
      for (var k in o) pairs.push(k + delimit1 + o[k]);
      return pairs.join(delimit2);
    }
116379
function atDelim(str, position, delim) {
  if (str.charAt(position) !== delim.charAt(0)) {
    return false;
  }
  for (let i = 1, l = delim.length; i < l; i++) {
    if (str.charAt(position + i) !== delim.charAt(i)) {
      return false;
    }
  }

  return true;
}
151204
function substrAtNthOccurence(string, start, delimiter) {
  const _delimiter = getValueWithDefault(delimiter, '.');
  const _start = getValueWithDefault(start, 1);
  const tokens = string.split(_delimiter).slice(_start);
  return tokens.join(_delimiter);
}