Java String Chop chopCommentFromArgs(String[] args)

Here you can find the source of chopCommentFromArgs(String[] args)

Description

chop Comment From Args

License

Open Source License

Declaration

public static String[] chopCommentFromArgs(String[] args) 

Method Source Code

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

public class Main {
    public static String[] chopCommentFromArgs(String[] args) {
        if (args == null) {
            return null;
        } // Written with help from Trevor Walker.
        int commentStart = -1;
        for (int i = 0; i < args.length; i++) {
            if (args[i] != null && args[i].startsWith("//")) {
                commentStart = i;//from w ww .  j a va2s. c  o  m
                break;
            }
        }
        if (commentStart < 0) {
            return args;
        }
        String[] newArgs = new String[commentStart];
        for (int i = 0; i < commentStart; i++) {
            newArgs[i] = args[i];
        }
        return newArgs;
    }
}

Related

  1. chop(StringBuffer buffer, int chars)
  2. chopAccelerator(final String title)
  3. ChopAllLf(String this_string, String chomp_off)
  4. ChopAllRt(String this_string, String chomp_off)
  5. chopBraces(String s)
  6. chopExt(String orig)
  7. chopFirstComponent(String s)
  8. chopFractionalPart(float original, int no_of_digits )
  9. chopId(String name)