Skip to content
Vitor de Moraes edited this page Mar 26, 2014 · 4 revisions

Formatadores

Formatando...

Formatter formatter = new NITFormatter();
String unfotmatedValue = "17033259504";
String formatedValue = formatter.format(unfotmatedValue);
// formatedValue = "170.33259.50-4";

Removendo formatação...

Formatter formatter = new NITFormatter();
String fotmatedValue = "170.33259.50-4";
String unformatedValue = formatter.unformat(fotmatedValue);
// unformatedValue = "17033259504";

Lista de todos os formatadores

  • CPFFormatter
  • CNPJFormatter
  • NITFormatter