Settrims

Class settrims provides two functions. Method mytrims accepts a string object (usually an url name), isolates the filename from the host, port and returns the filename. Method xnoloops accepts a string object (usually a filename), compares it against the array of strings ie. the globalfiledbase containing a list of previously pulled files from the net and returns false if a match is found.

// filename: settrims.java

class settrims { public static String mytrims(String myfiletostring1) { String ss; char nn[ ]=new char[100]; for(int p=(myfiletostring1.length( )-1);p>=0;p--) { char q = myfiletostring1.charAt(p); if(p==(myfiletostring1.length( )-1) && (q == '/')) continue; if(q=='/') break; nn[p] = myfiletostring1.charAt(p); } ss= new String(nn); ss=ss.trim( ); return ss; } public static boolean xnoloops(String ss2) { boolean ssss = true; for(int a = 0; a<InetClient.fileindex; a++) { // System.out.println("Comparing"+ss2+"with"+InetClient.globalfiledbase[a]+"|"); // System.out.println("result"+ss2.compareTo(InetClient.globalfiledbase[a])); if((ss2.compareTo(InetClient.globalfiledbase[a]))==0) { ssss = false; break; } } //ends for loop // System.out.println(" ssss = "+ssss); return ssss; } }

next >>

Index