List of usage examples for org.apache.commons.lang3 StringUtils leftPad
public static String leftPad(final String str, final int size, String padStr)
Left pad a String with a specified String.
Pad to a size of size .
StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, "z") = "zzz" StringUtils.leftPad("bat", 3, "yz") = "bat" StringUtils.leftPad("bat", 5, "yz") = "yzbat" StringUtils.leftPad("bat", 8, "yz") = "yzyzybat" StringUtils.leftPad("bat", 1, "yz") = "bat" StringUtils.leftPad("bat", -1, "yz") = "bat" StringUtils.leftPad("bat", 5, null) = " bat" StringUtils.leftPad("bat", 5, "") = " bat"
From source file:com.soebes.test.Main.java
public static void main(String[] args) { System.out.println("Argument is : " + StringUtils.leftPad(args[0], 3, '0')); }
From source file:com.music.util.SecurityUtils.java
public static void main(String[] args) { System.out.println(hmac(StringUtils.leftPad("5", 10, '0'), "zonUgkO8FxaPbVfESWZhfzCB")); }
From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java
public static String completarEspaciosIzquierda(String cadena, int tamanio, String caracter) { return StringUtils.leftPad(cadena, tamanio, caracter); }
From source file:com.bellman.bible.service.format.osistohtml.strongs.StrongsUtil.java
public static String createStrongsLink(String protocol, String strongsNumber, String content, String cssClass) { // pad with leading zeros to 5 characters String paddedRef = StringUtils.leftPad(strongsNumber, 5, "0"); StringBuilder tag = new StringBuilder(); // create opening tag for Strong's link tag.append("<a href='"); // calculate uri e.g. H:01234 tag.append(protocol).append(":").append(paddedRef); // set css class tag.append("' class='" + cssClass + "'>"); // descriptive string tag.append(content);// w w w . j a v a 2 s .co m // link closing tag tag.append("</a>"); String strTag = tag.toString(); return strTag; }
From source file:com.tag.HexUtils.java
public static String toHex(int i) { String hex = Integer.toHexString(i); int size = 2; hex = StringUtils.leftPad(hex, size, '0'); hex = hex.toUpperCase();// www .j av a 2s. c o m int length = hex.length(); int beginIndex = length - size; return hex.substring(beginIndex); }
From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java
public static String completarFloat(float numero, int entero, int decimales) { String numeroTxt = numero + ""; String enteroTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[0]; String decimalTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[1]; enteroTxt = StringUtils.leftPad(enteroTxt, entero, "0"); decimalTxt = StringUtils.rightPad(enteroTxt, entero, "0"); return enteroTxt + decimalTxt; }
From source file:edu.pitt.dbmi.edda.operator.regexop.rank.Rank.java
public static Rank newRank(LabeledDocument labeledDocument, RegularExpression regularExpression) { Rank rank = new Rank(nextRankNumber++); rank.labeledDocument = labeledDocument; rank.regularExpression = regularExpression; rank.key = ""; rank.key += StringUtils.leftPad(labeledDocument.documentNumber + "", 10, "0"); rank.key += ":"; rank.key += StringUtils.leftPad(regularExpression.regularExpressionNumber + "", 10, "0"); return rank;//from www . java 2 s.co m }
From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.ValidadorFormato.java
public static String completarFloat(String numero, int entero, int decimales) { String numeroTxt = numero + ""; String enteroTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[0]; String decimalTxt = StringUtils.splitByWholeSeparator(numeroTxt, ".")[1]; enteroTxt = StringUtils.leftPad(enteroTxt, entero, "0"); decimalTxt = StringUtils.rightPad(decimalTxt, decimales, "0"); return enteroTxt + decimalTxt; }
From source file:modelos.CustomListModelLibros.java
@Override public Object getElementAt(int index) { Libros p = lista.get(index);/*w ww . j av a2s . co m*/ return "Isbn :" + StringUtils.leftPad(String.valueOf(p.getIsbn()), 15, '0') + " Titulo: " + StringUtils.rightPad(p.getTitulo(), 50, ' ') + " Autor: " + StringUtils.rightPad(p.getAutor(), 30, ' ') + " Categorias: " + StringUtils.rightPad(p.getCategorias(), 30, ' '); }
From source file:modelos.CustomListModelCopias.java
@Override public Object getElementAt(int index) { Copias p = lista.get(index);// w w w . j a va 2s . co m return "Cdigo copia: " + StringUtils.leftPad(String.valueOf(p.getNumeroSerie()), 13, '0') + " Titulo: " + StringUtils.rightPad(p.getTitulo(), 50, ' '); }