Ir para conteúdo

Posts Recomendados

Postado

Bom, queria algum code quem transformaria o money do jogador em vez de 10.000 para 10k ou 1.000.000 para 1M!

Agradeço desde já

 

Exemplo:

Screenshot_2.png.335ecda8579d4ca1d033b171e3d3a66b.png

Postado

public static String format(double value) {
        DecimalFormat decimalFormat = new DecimalFormat("#,###", new DecimalFormatSymbols(new Locale("pt", "BR")));
        return decimalFormat.format(value);
    }

    public static String getFormat(double value) {
        String[] simbols = new String[] { "", "K", "M", "B", "T", "Q", "QI", "S", "SEP", "OC", "N", "DEC", "UN", "DUO",
                "TRE" };
        int index;
        for (index = 0; value / 1000.0 >= 1.0; value /= 1000.0, ++index) {
        }
        return VariaveisAPI.format(value) + simbols[index];
    }

Postado
  • private static String formats[] = {"-", "-", "K", "M", "B", "T", "Q", "QT", "S", "ST", "QR"};
    public String format(Object value){
            String val = new DecimalFormat("#,###").format(value).replace(".", ",");
            Integer ii = val.indexOf(","), i = val.split(",").length;
            if(ii == -1)return val;
            return (val.substring(0, ii+2)+formats[i]).replace(",0", "");
        }

     

Postado

gb-white.png?width=400&height=225

Sua dúvida foi marcada como resolvida pela nossa equipe. Caso sua dúvida não tenha sido sanada, crie outro tópico.

OBS: Essa mensagem é automática.

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...