Formats a String to fit into the connectiontable.

@param s  The String to be formated
@param le The length of the String
@return The String to be written in the connectiontable
767745
protected static String formatMDLString(String s, int le) {
        s = s.trim();
        if (s.length() > le) return s.substring(0, le);
        int l;
        l = le - s.length();
        for (int f = 0; f < l; f++)
            s += " ";
        return s;
    }
362453
public static final void format(StringBuilder sb, double v, String format)
    {
        sb.append(String.format(Locale.US, format, v));
        int length = sb.length();
        while (true)
        {
            char cc = sb.charAt(length-1);
            if (cc == '.')
            {
                length--;
                break;
            }
            if (cc != '0')
            {
                break;
            }
            length--;
        }
        sb.setLength(length);
    }
299753
public static String format(Instance inst, String[] labels, String[] gold) {

		StringBuilder sb = new StringBuilder();
		String[][] data = (String[][]) inst.getSource();
		int feaNum = data.length;
		int seqNum = data[0].length;
		for (int i = 0; i < seqNum; i++) {
			for (int j = 0; j < feaNum; j++) {
				sb.append(data[j][i]);
				sb.append("\t");
			}
			sb.append(labels[i]);
			sb.append("\t");
			sb.append(gold[i]);
			sb.append("\n");
		}
		return sb.toString();
	}
1057847
@Override
    public String serialize(Collection<String> c, SerializationContext context) {
        StringBuilder sb = new StringBuilder();
        for (String s : c) {
            sb.append(s);
            sb.append(SEPARATOR);
        }
        sb.setLength(sb.length() - SEPARATOR.length());
        return sb.toString();
    }
1033903
public static String format(String str, Object... args) {
        str = str.replaceAll("\\{}", "%s");

        return String.format(str, args);
    }
231584
public String format(Iterable<?> iterable) {
    if (iterable == null) {
      return StringUtils.EMPTY;
    }
    return format(iterable.iterator());
  }
705767
public static String join(Collection<? extends Object> lst, String separator) {
        StringBuilder buf = new StringBuilder(lst.size() * 64);
        boolean first = true;
        for (Object value : lst) {
            if (first) first = false; else buf.append(separator);
            buf.append(value.toString());
        }
        return buf.toString();
    }
305501
static public final String formatForSource(String s) {
        StringBuilder buffer = new StringBuilder();
        for (int i=0; i<s.length();) {
            if (i > 0) buffer.append('+').append(LINE_SEPARATOR);
            buffer.append("        \"");
            int count = 11;
            while (i<s.length() && count<80) {
                char c = s.charAt(i++);
                if (c < '\u0020' || c == '"' || c == '\\') {
                    if (c == '\n') {
                        buffer.append("\\n");
                        count += 2;
                    } else if (c == '\t') {
                        buffer.append("\\t");
                        count += 2;
                    } else if (c == '\r') {
                        buffer.append("\\r");
                        count += 2;
                    } else {
                        // Represent control characters, backslash and double quote
                        // using octal notation; otherwise the string we form
                        // won't compile, since Unicode escape sequences are
                        // processed before tokenization.
                        buffer.append('\\');
                        buffer.append(HEX_DIGIT[(c & 0700) >> 6]); // HEX_DIGIT works for octal
                        buffer.append(HEX_DIGIT[(c & 0070) >> 3]);
                        buffer.append(HEX_DIGIT[(c & 0007)]);
                        count += 4;
                    }
                }
                else if (c <= '\u007E') {
                    buffer.append(c);
                    count += 1;
                }
                else {
                    buffer.append("\\u");
                    buffer.append(HEX_DIGIT[(c & 0xF000) >> 12]);
                    buffer.append(HEX_DIGIT[(c & 0x0F00) >> 8]);
                    buffer.append(HEX_DIGIT[(c & 0x00F0) >> 4]);
                    buffer.append(HEX_DIGIT[(c & 0x000F)]);
                    count += 6;
                }
            }
            buffer.append('"');
        }
        return buffer.toString();
    }
1028102
public static String toUpperCaseFirstOne(String s) {
		if (Character.isUpperCase(s.charAt(0)))
			return s;
		else
			return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
	}
1118204
public static String wrap(String s) {
		StringBuilder sb = new StringBuilder();

		sb.append("(");
		sb.append(s);
		sb.append(")");

		return sb.toString();
	}
816164
@Override
  public String escape(String s) {
    int slen = s.length();
    for (int index = 0; index < slen; index++) {
      char c = s.charAt(index);
      if (c >= safeOctets.length || !safeOctets[c]) {
        return escapeSlow(s, index);
      }
    }
    return s;
  }
492194
public static String format(Collection<String> d, String sep) {
    if(d == null) {
      return "null";
    }
    if(d.isEmpty()) {
      return "";
    }
    if(d.size() == 1) {
      return d.iterator().next();
    }
    int len = sep.length() * (d.size() - 1);
    for(String s : d) {
      len += s.length();
    }
    Iterator<String> it = d.iterator();
    StringBuilder buffer = new StringBuilder(len) //
        .append(it.next());
    while(it.hasNext()) {
      buffer.append(sep).append(it.next());
    }
    return buffer.toString();
  }
821420
protected static final String printable(String s) {
		if (s == null)
			return "null";
		StringBuffer retval = new StringBuffer(s.length() + 16);
		retval.append("'");
		@SuppressWarnings("unused")
		char ch;
		for (int i = 0; i < s.length(); i++) {
			addPrintable(retval, s.charAt(i));
		}
		retval.append("'");
		return retval.toString();
	}
605364
public static String normalizeCharset(String s) {
        String n = CHARSETS.get(s);
        return (n == null) ? s : n;
    }
1104676
@SuppressWarnings("unchecked")
	public String strLabeling(String data){
		List lblSeqs = seqLabeling(data);
		String ret = dataWriter.writeString(lblSeqs);
		return ret;
	}
600953
public String formatAsString(final ObjectCell<?> cell, final Locale locale) {
        return format(cell, locale).getText();
    }
139394
static String format(String messageFormat, Object... messageArgs) {
        return String.format(messageFormat, messageArgs);
    }