public static String leftStr ( String str , int length ) { return str . substring ( 0 , Math . min ( str . length ( ) , length ) ) ; }
Returns a substring of the given string representing the length most - left characters