Java Array Empty Check removeNetLogoCommentsAndEmptyLines( String lines[])

Here you can find the source of removeNetLogoCommentsAndEmptyLines( String lines[])

Description

remove Net Logo Comments And Empty Lines

License

Open Source License

Declaration

public static ArrayList<String> removeNetLogoCommentsAndEmptyLines(
            String lines[]) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> removeNetLogoCommentsAndEmptyLines(
            String lines[]) {// w w  w.ja va 2  s  .c  om
        ArrayList<String> result = new ArrayList<String>();
        for (int i = 0; i < lines.length; i++) {
            String line;
            int semicolon = lines[i].indexOf(';');
            if (semicolon < 0) {
                line = lines[i];
            } else {
                line = lines[i].substring(0, semicolon);
            }
            if (!line.trim().isEmpty()) {
                result.add(line);
            }
        }
        return result;
    }
}

Related

  1. removeEmptyLines(String lines[])
  2. removeEmptyString(final String[] words)
  3. removeEmptyString(String[] strOrigin)
  4. removeEmptyStrings(String[] data)
  5. removeEmptyStringsInArray(String[] array)
  6. removeNullsAndEmptyString(final String[] strArray)
  7. removeTrailingEmptyLines(String[] lines)