question: protected static String normalizeUrlEnding ( String link ) { if ( link . indexOf ( "#" ) > - 1 ) link = link . substring ( 0 , link . indexOf ( "#" ) ) ; if ( link . endsWith ( "?" ) ) link = link . substring ( 0 , link . length ( ) - 1 ) ; if ( link . endsWith ( "/" ) ) link = link . substring ( 0 , link . length ( ) - 1 ) ; return link ; }
target:  Normalizes a URL string by removing anchor part and trailing slash