Format a <tt>String</tt>.
344005
public FormatStringBuffer format(String str) {

        if (str == null) str = "<NULL>";

        Format fmt = getFormat();

        if (fmt.type != STRING) throw new IllegalArgumentException("Expected a String format");

        int len = str.length();
        if (fmt.precision != -1 && len > fmt.precision) len = fmt.precision;

        if ((fmt.flags & LEFT) != LEFT) while (len < fmt.fieldWidth--)
            buffer.append(' ');

        for (int i = 0; i < len; ++i)
            buffer.append(str.charAt(i));

        while (len < fmt.fieldWidth--)
            buffer.append(' ');

        return this;
    }
418010
public String format(Object value) {
    ValueFormatter<Object> valueFormatter = VALUE_FORMATTERS.get(value.getClass());
    if (valueFormatter != null) {
      return valueFormatter.format(this, value);
    } else {
      return value.toString();
    }
  }
1172887
function format(string) {
        string = string.toLowerCase().replace(/-(.)?/g, function ($0, $1) {
            return '-' + $1.toUpperCase();
        });

        return string.charAt(0).toUpperCase()
            + string.substring(1);
    }
750210
static String toFormattedString(final String iban) {
        final StringBuilder ibanBuffer = new StringBuilder(iban);
        final int length = ibanBuffer.length();

        for (int i = 0; i < length / 4; i++) {
            ibanBuffer.insert((i + 1) * 4 + i, ' ');
        }

        return ibanBuffer.toString().trim();
    }
643271
def _(text, *args, **kwargs):
    """"""
    msg = _t.gettext(text)
    if args or kwargs:
        return msg.format(*args, **kwargs)
    else:
        return msg
204837
function format(text) {
    const lintResult = linter.executeOnText(text)
    return lintResult.results[0].output || text
}
973267
protected String formatStr(int bits, String val, Object key) {
        if (val.equals("")) {
            return val;
        } else if (val.length() > bits) {
            //throw new Exception();
            sbError.append("! Waring: There is a variable [").append(key).append("] with oversized content [").append(val).append("], only first ").append(bits).append(" bits will be applied.\r\n");
            return val.substring(0, bits);
        }

        return val;
    }
809644
public static String format(String s, Map<String, String> map) {
		StringBuilder sb = new StringBuilder((int)(s.length() * 1.5));
		int cursor = 0;
		for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf('}', start)) != -1;) {
			sb.append(s.substring(cursor, start));
			String key = s.substring(start + 2, end);
			sb.append(map.get(StringUtils.trim(key)));
			cursor = end + 1;
		}
		sb.append(s.substring(cursor, s.length()));
		return sb.toString();
	}
1126269
function format(str, swaps) {
  // First replace the %S strings
  var index = 0;
  str = str.replace(/%S/g, function() {
    return swaps[index++];
  });
  // Then %n$S style strings
  str = str.replace(/%([0-9])\$S/g, function(match, idx) {
    return swaps[idx - 1];
  });
  return str;
}
1097646
function format(string) {
  string = _.toString(string);

  // Replace all code snippets with a token.
  var snippets = [];
  string = string.replace(reCode, function(match) {
    snippets.push(match);
    return token;
  });

  return string
    // Add line breaks.
    .replace(/:\n(?=[\t ]*\S)/g, ':<br>\n')
    .replace(/\n( *)[-*](?=[\t ]+\S)/g, '\n<br>\n$1*')
    .replace(/^[\t ]*\n/gm, '<br>\n<br>\n')
    // Normalize whitespace.
    .replace(/\n +/g, ' ')
    // Italicize parentheses.
    .replace(/(^|\s)(\(.+\))/g, '$1*$2*')
    // Mark numbers as inline code.
    .replace(/[\t ](-?\d+(?:.\d+)?)(?!\.[^\n])/g, ' `$1`')
    // Replace all tokens with code snippets.
    .replace(reToken, function(match) {
      return snippets.shift();
    })
    .trim();
}
825002
private static String formatValue(String value)
	{
		if(value == null)
			return "";
		
		value = value.trim();
		
		if(value.startsWith("\"")|| value.startsWith("'"))
			value = value.substring(1);
		
		if(value.endsWith("\"")|| value.endsWith("'"))
			value = value.substring(0, value.length() -1);
		
		return value;
	}
1051994
public void setTtl(String ttlString) {
	if ( ttlString != null && !ttlString.isEmpty() )
    try {
      this.ttl = Integer.valueOf(ttlString);
    } catch (NumberFormatException e) {
      LOGGER.warn("Error trying to format the string " + ttlString + " into an Integer.");
    }
  }
760875
def format(self):
        """"""
        value = self._schema.get("format", None)
        if value is None:
            return
        if not isinstance(value, basestring):
            raise SchemaError(
                "format value {0!r} is not a string".format(value))
        if value in [
            'date-time',
            'regex',
        ]:
            return value
        raise NotImplementedError(
            "format value {0!r} is not supported".format(value))
343658
function stringFormat(source) {
        var args = arguments;
        return source.replace(
            /\{([0-9]+)\}/g,
            function (match, index) {
                return args[index - 0 + 1];
            });
    }
177803
private <T> String format(final T t,
                              final IClassContainer container) {
        final List<ExportContainer> exportContainers = extractExportContainers(t, container);

        final String resultValues = exportContainers.stream()
                .map(c -> convertFieldValue(container.getField(c.getExportName()), c))
                .collect(Collectors.joining(", "));

        return "(" + resultValues + ")";
    }
702055
private static String formatListToString(final List<String> list)
	{
		int lineLength = 0;
		final StringBuffer sb = new StringBuffer();
		for (final String str : list)
		{
			final int length = str.length();
			lineLength = length + lineLength;
			sb.append(str);
			sb.append(", ");
			if (100 < lineLength)
			{
				sb.append("\n");
				lineLength = 0;
			}
		}
		return sb.toString().trim();
	}
560084
def _indent(s, indent='  '):
    """"""
    if isinstance(s, six.string_types):
        return '\n'.join(('%s%s' % (indent, line) for line in s.splitlines()))
    return s