question: public static String cutToIndexOf ( String string , char c ) { int i = string . indexOf ( c ) ; if ( i != - 1 ) { string = string . substring ( 0 , i ) ; } return string ; }
target:  Cuts the string from beginning to the first index of provided char.