Here you can find the source of splitAndTrim(String tags, String separator)
public static List<String> splitAndTrim(String tags, String separator)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> splitAndTrim(String tags, String separator) { List<String> result = new ArrayList<String>(); if (tags != null && tags.length() > 0) { for (String piece : tags.split(separator)) { if (hasText(piece)) { result.add(piece.trim()); }/*w ww .ja v a 2s. co m*/ } } return result; } public static boolean hasText(String str) { return hasLength(str) && str.trim().length() > 0; } public static boolean hasLength(String str) { return str != null && str.length() > 0; } }