Here you can find the source of ltrim(String s)
Parameter | Description |
---|---|
s | the string to be processed |
public static String ltrim(String s)
//package com.java2s; public class Main { /**//w w w . j a va 2s. c o m * Remove all leading blanks. * @param s the string to be processed * @return the result of the processing */ public static String ltrim(String s) { int index = 0; while (index < s.length() && isSpace(s.charAt(index))) index++; return s.substring(index, s.length()); } /** * Check whether a character is a blank. * @param c the character to be checked * @return the result of the test */ public static boolean isSpace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; } }