test_class.declarator: logger = LoggerFactory.getLogger(MobileTextUtilTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger logger = LoggerFactory.getLogger(MobileTextUtilTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: ch-commons-charset/src/test/java/com/cloudhopper/commons/charset/MobileTextUtilTest.java
test_class.identifier: MobileTextUtilTest
test_case.body: @Test
      public void replaceAccentedChars() throws Exception {
          String source = null;
          StringBuilder buffer = null;
          int replaced = -1;
  
          source = "hello";
          buffer = new StringBuilder(source);
          replaced = MobileTextUtil.replaceAccentedChars(buffer);
          Assert.assertEquals(0, replaced);
          Assert.assertEquals(source, buffer.toString());
  
          source = "h\u00E9llo";
          buffer = new StringBuilder(source);
          replaced = MobileTextUtil.replaceAccentedChars(buffer);
          Assert.assertEquals(1, replaced);
          Assert.assertEquals("hello", buffer.toString());
  
          source = "\u00E8\u00E9\u00EA\u00EB\u00EF\u00F1\u00F2";
          buffer = new StringBuilder(source);
          replaced = MobileTextUtil.replaceAccentedChars(buffer);
          Assert.assertEquals(7, replaced);
          Assert.assertEquals("eeeeino", buffer.toString());
  
          source = "\u20AC";
          buffer = new StringBuilder(source);
          replaced = MobileTextUtil.replaceAccentedChars(buffer);
          Assert.assertEquals(0, replaced);
          Assert.assertEquals("\u20AC", buffer.toString());
      }
test_case.class_method_signature: MobileTextUtilTest.replaceAccentedChars()
test_case.full_signature: @Test public void replaceAccentedChars()
test_case.identifier: replaceAccentedChars
test_case.invocations: replaceAccentedChars assertEquals assertEquals toString replaceAccentedChars assertEquals assertEquals toString replaceAccentedChars assertEquals assertEquals toString replaceAccentedChars assertEquals assertEquals toString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void replaceAccentedChars()
focal_class.declarator: CHAR_TABLE = {
          { '\u2013', '-' },
          { '\u2014', '-' },
          { '\u2018', '\'' },
          { '\u2019', '\'' },
          { '\u201A', '\'' },
          { '\u201B', '\'' }, // U+201B ‛​ single high-reversed-9 quotation mark (HTML: &#8219; ), also called single reversed comma, quotation mark 
          { '\u201C', '"' },
          { '\u201D', '"' },
          { '\u201E', '"' },
          { '\u201F', '"' }, // U+201F ‟​ double high-reversed-9 quotation mark (HTML: &#8223; ), also called double reversed comma, quotation mark
          { '\u2020', '+' },
          { '\u2022', '.' },
          { '\u2026', '.' }, // actually "...", but just replacing with "."
          { '\u2039', '<' },
          { '\u203A', '>' },
          /** deprecated at recommendation by Turkcell - these replacements changed meaning too much */
          //{ '\u0131', '1' }, // U+0131 is a lower case letter dotless i (ı)
          //{ '\u0130', 'i' }, // U+0130 (İ) is capital i with dot
      }
focal_class.modifier: static public final
focal_class.original_string: static public final char[][] CHAR_TABLE = {
          { '\u2013', '-' },
          { '\u2014', '-' },
          { '\u2018', '\'' },
          { '\u2019', '\'' },
          { '\u201A', '\'' },
          { '\u201B', '\'' }, // U+201B ‛​ single high-reversed-9 quotation mark (HTML: &#8219; ), also called single reversed comma, quotation mark 
          { '\u201C', '"' },
          { '\u201D', '"' },
          { '\u201E', '"' },
          { '\u201F', '"' }, // U+201F ‟​ double high-reversed-9 quotation mark (HTML: &#8223; ), also called double reversed comma, quotation mark
          { '\u2020', '+' },
          { '\u2022', '.' },
          { '\u2026', '.' }, // actually "...", but just replacing with "."
          { '\u2039', '<' },
          { '\u203A', '>' },
          /** deprecated at recommendation by Turkcell - these replacements changed meaning too much */
          //{ '\u0131', '1' }, // U+0131 is a lower case letter dotless i (ı)
          //{ '\u0130', 'i' }, // U+0130 (İ) is capital i with dot
      };
focal_class.type: char[][]
focal_class.var_name: CHAR_TABLE
focal_class.file: ch-commons-charset/src/main/java/com/cloudhopper/commons/charset/MobileTextUtil.java
focal_class.identifier: MobileTextUtil
focal_class.class_method_signature: MobileTextUtil.replaceSafeUnicodeChars(StringBuilder buffer)
focal_class.full_signature: static public int replaceSafeUnicodeChars(StringBuilder buffer)
focal_class.identifier: replaceSafeUnicodeChars
focal_class.modifiers: static public
focal_class.parameters: (StringBuilder buffer)
focal_class.return: int
focal_class.signature: int replaceSafeUnicodeChars(StringBuilder buffer)
focal_class.class_method_signature: MobileTextUtil.replaceAccentedChars(StringBuilder buffer)
focal_class.full_signature: public static int replaceAccentedChars(StringBuilder buffer)
focal_class.identifier: replaceAccentedChars
focal_class.modifiers: public static
focal_class.parameters: (StringBuilder buffer)
focal_class.return: int
focal_class.signature: int replaceAccentedChars(StringBuilder buffer)
focal_method.body: public static int replaceAccentedChars(StringBuilder buffer) {
          // save the size before we strip out the accents
          int sizeBefore = buffer.length();
          // each accented char will be converted into 2 chars -- the ascii version
          // followed by the accent character
          String s = Normalizer.normalize(buffer, Normalizer.Form.NFD);
          // new size will include accented chars
          int sizeAfter = s.length();
          // efficiency check #1 - if the length hasn't changed, do nothing
          int replaced = sizeAfter - sizeBefore;
          if (replaced <= 0) {
              return 0;
          }
  
          // replace the accents with nothing
          s = s.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
          buffer.setLength(0);
          buffer.append(s);
          
          return replaced;
      }
focal_method.class_method_signature: MobileTextUtil.replaceAccentedChars(StringBuilder buffer)
focal_method.full_signature: public static int replaceAccentedChars(StringBuilder buffer)
focal_method.identifier: replaceAccentedChars
focal_method.invocations: length normalize length replaceAll setLength append
focal_method.modifiers: public static
focal_method.parameters: (StringBuilder buffer)
focal_method.return: int
focal_method.signature: int replaceAccentedChars(StringBuilder buffer)