@Test public void testGetStrongPaddedKey() { assertEquals("", getStrongPaddedKey(null)); assertEquals("", getStrongPaddedKey("")); assertEquals("g", getStrongPaddedKey("G")); assertEquals("h", getStrongPaddedKey("H")); assertEquals("000a", getStrongPaddedKey("A")); assertEquals("G1020", getStrongPaddedKey("strong:G1020")); assertEquals("G0001", getStrongPaddedKey("strong:G1")); assertEquals("G0012", getStrongPaddedKey("strong:G12")); assertEquals("G0123", getStrongPaddedKey("strong:G123")); assertEquals("G1234", getStrongPaddedKey("strong:G1234")); assertEquals("H0123", getStrongPaddedKey("strong:H123")); assertEquals("0001", getStrongPaddedKey("strong:1")); assertEquals("0012", getStrongPaddedKey("strong:12")); assertEquals("0123", getStrongPaddedKey("strong:123")); assertEquals("1234", getStrongPaddedKey("strong:1234")); assertEquals("H1234 H5678", getStrongPaddedKey("H01234 H5678")); assertEquals("H1234 H5678a", getStrongPaddedKey("H01234 H5678A")); assertEquals("H1234a H5678", getStrongPaddedKey("H01234A H5678")); }
public static String getStrongPaddedKey(final String key) { if (StringUtils.isBlank(key)) { return ""; } final StringBuilder sb = new StringBuilder(key.length()); final String[] split = key.toUpperCase(Locale.ENGLISH).split(" "); for (final String s : split) { final String strongNumber = getStrongLanguageSpecificKey(s); if (strongNumber == null) { continue; } final int length = strongNumber.length(); if (sb.length() > 0) { sb.append(' '); } final char firstChar = strongNumber.charAt(0); if (firstChar == 'G' || firstChar == 'H') { padPrefixedStrongNumber(sb, strongNumber, length, firstChar); } else { padNonPrefixedStrongNumber(sb, strongNumber, length); } } return sb.toString().trim(); }
StringConversionUtils { public static String getStrongPaddedKey(final String key) { if (StringUtils.isBlank(key)) { return ""; } final StringBuilder sb = new StringBuilder(key.length()); final String[] split = key.toUpperCase(Locale.ENGLISH).split(" "); for (final String s : split) { final String strongNumber = getStrongLanguageSpecificKey(s); if (strongNumber == null) { continue; } final int length = strongNumber.length(); if (sb.length() > 0) { sb.append(' '); } final char firstChar = strongNumber.charAt(0); if (firstChar == 'G' || firstChar == 'H') { padPrefixedStrongNumber(sb, strongNumber, length, firstChar); } else { padNonPrefixedStrongNumber(sb, strongNumber, length); } } return sb.toString().trim(); } }
StringConversionUtils { public static String getStrongPaddedKey(final String key) { if (StringUtils.isBlank(key)) { return ""; } final StringBuilder sb = new StringBuilder(key.length()); final String[] split = key.toUpperCase(Locale.ENGLISH).split(" "); for (final String s : split) { final String strongNumber = getStrongLanguageSpecificKey(s); if (strongNumber == null) { continue; } final int length = strongNumber.length(); if (sb.length() > 0) { sb.append(' '); } final char firstChar = strongNumber.charAt(0); if (firstChar == 'G' || firstChar == 'H') { padPrefixedStrongNumber(sb, strongNumber, length, firstChar); } else { padNonPrefixedStrongNumber(sb, strongNumber, length); } } return sb.toString().trim(); } private  StringConversionUtils(); }
StringConversionUtils { public static String getStrongPaddedKey(final String key) { if (StringUtils.isBlank(key)) { return ""; } final StringBuilder sb = new StringBuilder(key.length()); final String[] split = key.toUpperCase(Locale.ENGLISH).split(" "); for (final String s : split) { final String strongNumber = getStrongLanguageSpecificKey(s); if (strongNumber == null) { continue; } final int length = strongNumber.length(); if (sb.length() > 0) { sb.append(' '); } final char firstChar = strongNumber.charAt(0); if (firstChar == 'G' || firstChar == 'H') { padPrefixedStrongNumber(sb, strongNumber, length, firstChar); } else { padNonPrefixedStrongNumber(sb, strongNumber, length); } } return sb.toString().trim(); } private  StringConversionUtils(); boolean isDisplayableStrongNumber(final String strongNumber); static String getStrongKey(final String strong); static String getAnyKey(final String potentialKey); static String getStrongLanguageSpecificKey(final String key); static String getStrongPaddedKey(final String key); static String padPrefixedStrongNumber(final String strongNumber); static String getAnyKey(final String potentialKey, final boolean trimInitial); static String unAccent(final String word); static String unAccent(final String word, final boolean isGreek); static String unAccent(final String word, final boolean isGreek, boolean unpointHebrewVowels); static String unAccentLeavingVowels(final String word); static String unAccentHebrewLeavingVowels(final String word); static String adaptForTransliterationForIndexing(final String stepTransliteration,
                                                            final boolean isGreek); static List<TransliterationOption> adaptTransliterationForQuerying(
            final String stepTransliteration, final boolean isGreek); static List<TransliterationOption> multiplyTranslitOptions(final String baseString,
                                                                      final List<TransliterationRule> transliterationRules); static String transliterate(final String rawForm); static boolean startsWithPunctuation(final String s); }
StringConversionUtils { public static String getStrongPaddedKey(final String key) { if (StringUtils.isBlank(key)) { return ""; } final StringBuilder sb = new StringBuilder(key.length()); final String[] split = key.toUpperCase(Locale.ENGLISH).split(" "); for (final String s : split) { final String strongNumber = getStrongLanguageSpecificKey(s); if (strongNumber == null) { continue; } final int length = strongNumber.length(); if (sb.length() > 0) { sb.append(' '); } final char firstChar = strongNumber.charAt(0); if (firstChar == 'G' || firstChar == 'H') { padPrefixedStrongNumber(sb, strongNumber, length, firstChar); } else { padNonPrefixedStrongNumber(sb, strongNumber, length); } } return sb.toString().trim(); } private  StringConversionUtils(); boolean isDisplayableStrongNumber(final String strongNumber); static String getStrongKey(final String strong); static String getAnyKey(final String potentialKey); static String getStrongLanguageSpecificKey(final String key); static String getStrongPaddedKey(final String key); static String padPrefixedStrongNumber(final String strongNumber); static String getAnyKey(final String potentialKey, final boolean trimInitial); static String unAccent(final String word); static String unAccent(final String word, final boolean isGreek); static String unAccent(final String word, final boolean isGreek, boolean unpointHebrewVowels); static String unAccentLeavingVowels(final String word); static String unAccentHebrewLeavingVowels(final String word); static String adaptForTransliterationForIndexing(final String stepTransliteration,
                                                            final boolean isGreek); static List<TransliterationOption> adaptTransliterationForQuerying(
            final String stepTransliteration, final boolean isGreek); static List<TransliterationOption> multiplyTranslitOptions(final String baseString,
                                                                      final List<TransliterationRule> transliterationRules); static String transliterate(final String rawForm); static boolean startsWithPunctuation(final String s);  }