format a string using indexes, e.g. formatString("first name: {0}, last name: {1}", "Albert", "Einstein")
511375
function(template, args) {
      args = (args.constructor !== Array) ? Sysmo.makeArray(arguments).splice(1) : args;
      
      return template.replace(/\{(\d+)\}/g, function(match, capture) { 
        return args[capture];
      });
    }
1172887
function format(string) {
        string = string.toLowerCase().replace(/-(.)?/g, function ($0, $1) {
            return '-' + $1.toUpperCase();
        });

        return string.charAt(0).toUpperCase()
            + string.substring(1);
    }
542088
def get_pairs(self, format_string):
        
        for token in self.get_tokens(format_string):
            match = self.name_pattern.search(token)
            name = match.group(1) if match else None
            yield FormatStringToken(name=name, text=token)
1035738
protected function formatIndex($name)
    {
        if (\is_string($name)) {
            $exp = explode('.', $name);

            if (0 < \count($exp)) {
                $name = $exp[\count($exp) - 1];
            }
        }

        return $name;
    }
684728
def format_name(net: str) -> str:
        ''''''

        if net.startswith('t') or 'testnet' in net:
            net = net[1:] + '-test'
        else:
            net = net

        return net
85581
function acceptParams(str, index) {
    var parts = str.split(/ *; */);
    var ret = {value: parts[0], quality: 1, params: {}, originalIndex: index};

    for (var i = 1; i < parts.length; ++i) {
        var pms = parts[i].split(/ *= */);
        if ('q' == pms[0]) {
            ret.quality = parseFloat(pms[1]);
        } else {
            ret.params[pms[0]] = pms[1];
        }
    }

    return ret;
}
519491
function formatString (string) {
    const separator = "\n";
    return Array.isArray(string) ?
        string.reduce((acc, line) => acc.concat(line.split(separator)), []) :
        string.split(separator);
}
712913
def format_value(self, val):
        """"""
        if isinstance(val, six.text_type):
            return self.format_string(val)
        else:
            return six.text_type(val)
734752
function(str, index) {
    // replace {{ xxx }}
    var obj = this
    str = str.replace(interpolateReg, function(match, interpolate) {
      try {
        /*jslint evil: true */
        var funcNames = ['','index'].concat(fakerFuncNames).concat(['return ' + interpolate + ';']),
        func = new (Function.prototype.bind.apply(Function, funcNames)),
        funcs = [function(){return index}].concat(fakerFuncs);

        return func.apply(obj, funcs);
        
      } catch(e)  {
        return e.message;
      }
    });

    // if result is true or false, parse it to boolean
    if(/^(true|false)$/.test(str)) {
      str = str === 'true';
    }

    // if result is digit, parse it to float
    if(/^[-+]?\d*\.?\d+$/.test(str)) {
      str = parseFloat(str);
    }

    return str;
  }
349334
def format_index(prefix, timestamp, sep='-'):
        
        tz_info = tz.tzutc()

        # ex. logstash-other-2017.05.09
        return "{prefix}{sep}{date}".format(
            prefix=prefix, sep=sep, date=datetime.fromtimestamp(timestamp, tz=tz_info).strftime('%Y.%m.%d'))
337957
def format_name(self):
        
        format_data = self.get_format_data()
        return Formatter().vformat(self.string_formatter, args=[], kwargs=format_data)
877027
def _convert_string_name(self, k):
        """"""
        k = String(k, "iso-8859-1")
        klower = k.lower().replace('_', '-')
        bits = klower.split('-')
        return "-".join((bit.title() for bit in bits))
443600
function (str, index) {
            var res = false;
            for (var i = index - 1; i >= 0; i--) {
                if (str.charAt(i) == "\\") {
                    res = !res;
                } else {
                    return res;
                }
            }
            return res;
        }
1339550
def format_name(text):
    """"""
    name = unescape(text)
    name = asciify(name.replace(u'&', u'And').replace(u'@', u'At'))
    name = capfirst(name)
    return name
634265
def get_string_index_oid(self, s):
        """"""
        return (len(self.get_bytes(s)), ) + self.get_bytes(s)
783627
private String stringAt(int index) {
        // Determine the offset from the start of the string pool.
        int offset = m_stringOffsets[index];

        // For convenience, wrap the string pool in ByteBuffer
        // so that it will handle advancing the buffer index.
        ByteBuffer buffer =
                ByteBuffer.wrap(m_stringPool, offset, m_stringPool.length - offset)
                        .order(ByteOrder.BIG_ENDIAN);

        // Now get the decoded string length.
        int length = decodeLength(buffer);

        StringBuilder stringBuilder = new StringBuilder();

        for (int i = 0; i < length; i++) {
            if (m_isUtf8) {
                stringBuilder.append((char) buffer.get());
            } else {
                int byte1 = buffer.get();
                int byte2 = buffer.get();
                stringBuilder.append((char) (byte2 | byte1));
            }
        }

        return stringBuilder.toString();
    }
1183047
def format_value(self, value, padding):
        """"""

        # padding = padding - 1 if value < 0 and padding > 0 else padding
        # prefix = '-' if value < 0 else ''

        if padding:
            return "{:0{pad}d}".format(value, pad=padding)

        else:
            return str(value)