Here you can find the source of left(String baseString, int pos)
public static String left(String baseString, int pos)
//package com.java2s; /**// w w w .j a va 2 s. c om * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was written * by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. */ public class Main { public static String left(String baseString, int pos) { int diLength; if (baseString == null || pos <= 0) { return null; } else { diLength = baseString.length(); if (diLength < pos) { return baseString.substring(0); } else { return baseString.substring(0, pos); } } } public static final int length(String baseString) { if (baseString == null) return 0; else return baseString.length(); } public static final String substring(String baseString, int start, int end) { if (baseString == null) return null; else if (start >= baseString.length() || start < 0 || end < 0 || start > end) return null; else if (end >= baseString.length()) return baseString.substring(start); else { return baseString.substring(start, end); } } public static final String substring(String baseString, int start) { if (baseString == null) return null; else return substring(baseString, start, baseString.length()); } }