public static String getPrefix ( String input , char delimiter ) { int index = input . indexOf ( delimiter ) ; if ( index > - 1 ) { return input . substring ( 0 , index ) ; } return input ; }
Returns the prefix of the input string from 0 to the first index of the delimiter OR it returns the input string .