Here you can find the source of ltrimNewline(String s)
\n
character
Parameter | Description |
---|---|
s | a parameter |
public static String ltrimNewline(String s)
//package com.java2s; public class Main { /**//w ww . j a v a 2s .co m * Trims specified string from left and stop at <code>\n</code> character * * @param s */ public static String ltrimNewline(String s) { if (s == null) { return null; } int index = 0; int len = s.length(); while (index < len && Character.isWhitespace(s.charAt(index))) { if (s.charAt(index) == '\n') { break; } index++; } if (index == 0) { return s; } return (index >= len) ? "" : s.substring(index); } }