Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 12th, 2011  |  syntax: Java  |  size: 0.62 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public static boolean isPrefix(String in){
  2.  
  3.         if(in.length() == 1)
  4.             for(int i = 0; i < vars.length; i++)
  5.                 if(in.equals(vars[i]))
  6.                     return true;
  7.         else {
  8.                 if(in.startsWith("/") || in.startsWith("*") ||
  9.                    in.startsWith("+") || in.startsWith("-")){
  10.  
  11.                 for(int k = 1; k < in.length(); k++){
  12.                     if(isPrefix(in.substring(1,k)) &&
  13.                        isPrefix(in.substring(k,in.length())))
  14.                             return true;
  15.                 }
  16.                 }
  17.         }
  18.         return false;
  19.     }
  20.  
clone this paste RAW Paste Data