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