예제 #1
0
  public String format(
      Object obj, ETipo tipo, int tam, int dec, boolean maiusculo, boolean tiraacento) {

    String retorno = null;
    String str = null;

    if (obj == null) {
      str = "";
    } else {
      str = obj.toString();
      if (maiusculo) {
        str = str.toUpperCase();
      }
      if (tiraacento) {
        str = tiratodoacento(str);
      }
    }

    if (tipo == ETipo.$9) {

      if (dec > 0) {
        retorno = Funcoes.transValor(str, tam, dec, true);
      } else {
        retorno = StringFunctions.strZero(str, tam);
      }
    } else {
      retorno = Funcoes.adicionaEspacos(str, tam);
    }

    return retorno;
  }