public static String removeStartingChars ( String s , char c ) { int lastToRemove = - 1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == c ) { lastToRemove = i ; continue ; } if ( s . charAt ( i ) != c ) { break ; } } if ( lastToRemove < 0 ) return s ; return s . substring ( lastToRemove + 1 ) ; }
Remove all consecutive chars c from the beginning of the string