Java examples for java.lang:String Trim
trim Line Separator from a string
//package com.java2s; public class Main { public static void main(String[] argv) { String txt = "java2s.com\n"; System.out.println(trimLineSeparator(txt)); }/*from www .j av a 2 s . com*/ private static final String separator = "\n"; public static String trimLineSeparator(String txt) { return txt.substring(0, txt.length() - separator.length()); } }