java - How can i substring of path based on my requirement? -


string root = getservletcontext().getrealpath(""); 

means i'm getting root value c:\users\vinay\documents\netbeansprojects\fileanalog\build\web\

but need root value output till c:\users\vinay\documents\netbeansprojects\fileanalog\ how can write new string root1 root till fileanalog.thanks help.

string root2 = root.substring(0, root.indexof("build"));

its working fine


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -