1 22 package org.netbeans.lib.cvsclient.command; 23 24 import java.util.*; 25 26 29 public class CommandUtils { 30 35 public static String getExaminedDirectory(String message, String examDirPattern) { 36 final int index = message.indexOf(examDirPattern); 37 final int startIndex = index + examDirPattern.length() + 1; 38 if (index < 0 || message.length() < startIndex + 1) { 39 return null; 40 } 41 42 return message.substring(startIndex); 43 } 44 45 50 public static String findUniqueString(String name, List list) { 51 if (name == null) { 52 return null; 53 } 54 int index = list.indexOf(name); 55 if (index >= 0) { 56 return (String )list.get(index); 57 } 58 else { 59 String newName = new String (name); 60 list.add(newName); 61 return newName; 62 } 63 } 64 } 65 | Popular Tags |