Determine the rootpath in Java

Simple approach using a replacesubstring function
Java

PLACE THIS FUCNTION DIRECTLY ABOVE public void NotesMain() {

public static String replaceSubString(
     		String s,
	        	String search,
     	   	String replace) {
		    int p = 0;
		    while (p < s.length() && (p = s.indexOf(search, p)) >= 0) {
     		   s = s.substring(0, p) + replace +
         		       s.substring(p + search.length(), s.length());
       	 		p += replace.length();
    			}
   	 	return s;
}

USING THE FUNCTION

String thisdbpath = db.getFilePath();
String rootpath = replaceSubString(thisdbpath,"orders.nsf", "");

Written by Frank Joseph Brefere III

Posted by fbrefere001 on Sunday April 5, 2009