Java String Truncate truncatePunctuation(String authority)

Here you can find the source of truncatePunctuation(String authority)

Description

truncate Punctuation

License

Open Source License

Declaration

private static String truncatePunctuation(String authority) 

Method Source Code

//package com.java2s;

public class Main {
    private static String truncatePunctuation(String authority) {
        while (authority.startsWith("("))
            // starting parenthesis of basionym authority
            authority = authority.substring("(".length()).trim();
        while (authority.endsWith("("))
            // end of '<name> (<year>)' authority after cropping year
            authority = authority.substring(0,
                    (authority.length() - "(".length())).trim();
        while (authority.endsWith(","))
            // end of '<name>, <year>' authority after cropping year
            authority = authority.substring(0,
                    (authority.length() - ",".length())).trim();
        while (authority.endsWith(")"))
            // end of '<name> (<year>)' authority or basionym authority
            authority = authority.substring(0,
                    (authority.length() - ")".length())).trim();
        return authority;
    }//from   w w  w .j a  va  2  s.com
}

Related

  1. truncateNumberSign(String s)
  2. truncateOnlyText(String text, int position)
  3. truncateOnSpace(String text, Integer length)
  4. truncateOrPadString(String str)
  5. truncatePrefixFromPath(String fileName)
  6. truncateSentence(String input, int length)
  7. truncateShortMessage(final String message)
  8. truncateStr(String str, int maxNumChars)
  9. truncateString(final String str, final int iMaxLength)