/** * Format nothing. Just use the control string. * * @return the formatted String. */ public String sprintf() { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); } return sb.toString(); }
/** * Format nothing. Just use the control string. * * @return the formatted String. */ public String sprintf() { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); } return sb.toString(); }
/** * Format an int. * * @param x * The int to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is f, e, E, g, G, s, or S. */ public String sprintf(int x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral());
while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral());
while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral());
while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral());
/** * Format a double. * * @param x * The double to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is c, C, s, S, d, d, x, X, or o. */ public String sprintf(double x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format an long. * * @param x * The long to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is f, e, E, g, G, s, or S. */ public String sprintf(long x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format an int. * * @param x * The int to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is f, e, E, g, G, s, or S. */ public String sprintf(int x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format a double. * * @param x * The double to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is c, C, s, S, d, d, x, X, or o. */ public String sprintf(double x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format an long. * * @param x * The long to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is f, e, E, g, G, s, or S. */ public String sprintf(long x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format a String. * * @param x * The String to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is neither s nor S. */ public String sprintf(String x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }
/** * Format a String. * * @param x * The String to format. * @return The formatted String. * @exception IllegalArgumentException * if the conversion character is neither s nor S. */ public String sprintf(String x) throws IllegalArgumentException { Enumeration e = vFmt.elements(); ConversionSpecification cs = null; char c = 0; StringBuilder sb = new StringBuilder(); while (e.hasMoreElements()) { cs = (ConversionSpecification) e.nextElement(); c = cs.getConversionCharacter(); if (c == '\0') sb.append(cs.getLiteral()); else if (c == '%') sb.append("%"); else sb.append(cs.internalsprintf(x)); } return sb.toString(); }