Here you can find the source of trimStringLineList(List
Parameter | Description |
---|---|
list | input List of String lines |
public static List<String> trimStringLineList(List<String> lines)
//package com.java2s; /**//from ww w. ja v a 2s . c o m * Copyright (C) 2015-present by Permeance Technologies * * This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. If * not, see <http://www.gnu.org/licenses/>. */ import java.util.ArrayList; import java.util.List; public class Main { /** * Trims a List of String lines. * * @param list input List of String lines * @return List of trimmed String itlinesems */ public static List<String> trimStringLineList(List<String> lines) { List<String> newLines = new ArrayList<String>(); if (lines != null) { for (String line : lines) { String str = line; str = line.trim(); String newLine = str; newLines.add(newLine); } } return newLines; } }