public static Optional < String > trimStart ( final String input , String ... chars ) { return Optional . ofNullable ( input ) . filter ( v -> ! v . isEmpty ( ) ) . map ( v -> { String pattern = String . format ( "^[%s]+" , join ( chars , "\\" ) ) ; return v . replaceAll ( pattern , "" ) ; } ) ; }
Removes leading characters from string .