@Test public void maskFormatTest() { Assert.assertEquals(MaskFormat.format("helo", "123"), "helo"); Assert.assertEquals(MaskFormat.format("", "hi"), "hi"); Assert.assertEquals(MaskFormat.format(null, "hi"), "hi"); Assert.assertEquals(MaskFormat.format("", null), null); Assert.assertEquals(MaskFormat.format(null, null), null); Assert.assertEquals(MaskFormat.format("____ ____ __", "1234567890"), "1234 5678 90"); Assert.assertEquals(MaskFormat.format("____#/__#/__", "2008-11-28"), "2008/11/28"); Assert.assertEquals(MaskFormat.format("__\\___", "1010"), "10_10"); Assert.assertEquals(MaskFormat.format("$$_$$", "1010", '$'), "10_10"); Assert.assertEquals(MaskFormat.format("1bla_bla__bla bla bla 12", "010"), "1bla0bla10bla bla bla 12"); }
public MaskFormat() { }
MaskFormat extends Format implements FormatProvider { public MaskFormat() { } }
MaskFormat extends Format implements FormatProvider { public MaskFormat() { } MaskFormat();  MaskFormat(String mask);  MaskFormat(String mask, char placeholder); }
MaskFormat extends Format implements FormatProvider { public MaskFormat() { } MaskFormat();  MaskFormat(String mask);  MaskFormat(String mask, char placeholder); static FormatFactory factory(); static String format(String mask, String str); static String format(String mask, String str, char placeholder); static String parse(String mask, String source); static String parse(String mask, String source, char placeholder); StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); String format(String str); @Override FormatFactory getFactory(); @Override String getFormatName(); String getMask(); char getPlaceholder(); String parse(String source); String parse(String source, ParsePosition pos); Object parseObject(String source); Object parseObject(String source, ParsePosition pos); void setMask(String mask); void setPlaceholder(char placeholder); }
MaskFormat extends Format implements FormatProvider { public MaskFormat() { } MaskFormat();  MaskFormat(String mask);  MaskFormat(String mask, char placeholder); static FormatFactory factory(); static String format(String mask, String str); static String format(String mask, String str, char placeholder); static String parse(String mask, String source); static String parse(String mask, String source, char placeholder); StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos); String format(String str); @Override FormatFactory getFactory(); @Override String getFormatName(); String getMask(); char getPlaceholder(); String parse(String source); String parse(String source, ParsePosition pos); Object parseObject(String source); Object parseObject(String source, ParsePosition pos); void setMask(String mask); void setPlaceholder(char placeholder);  }