Java String Split splitAt(final String input, final String seperator)

Here you can find the source of splitAt(final String input, final String seperator)

Description

Split a string at a separator and return the unique trimmed entries from the string.

License

Open Source License

Parameter

Parameter Description
input a parameter
seperator a parameter

Declaration

static public ArrayList<String> splitAt(final String input, final String seperator) 

Method Source Code


//package com.java2s;
/* Copyright (c) 2014 geOps - www.geops.de. All rights reserved.
 *
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.// w  w  w.j  a  v  a 2  s  .c  om
 */

import java.util.ArrayList;

public class Main {
    /**
     * Split a string at a separator and return the unique trimmed entries 
     * from the string.
     *  
     * @param input
     * @param seperator
     * @return
     */
    static public ArrayList<String> splitAt(final String input, final String seperator) {
        final String[] parts = input.split(seperator);
        final ArrayList<String> result = new ArrayList<String>();
        for (final String part : parts) {
            final String partTrimmed = part.trim();
            if (!partTrimmed.equals("")) {
                result.add(partTrimmed);
            }
        }
        return result;
    }
}

Related

  1. splitArguments(String str)
  2. splitArguments(String string)
  3. splitArguments(String string)
  4. splitArray(byte[] src, int size)
  5. splitArray(String[] srcArr, int start, int end)
  6. splitAtLastBlank(String s, int width)
  7. splitAttributes(final String dname)
  8. splitAuthors(String source)
  9. splitBreaks(String text)