Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ExtractIt
- {
- private String url;
- public static void main(String[] args) {
- String s = ExtractIt.extractIt("http://example.com/files/public_files/test.zip");
- String m = ExtractIt.extractIt("www.abc.com/pub/*aaa.html");
- System.out.println(s);
- System.out.println(m);
- }
- public static String extractIt (String url)
- {
- String[] s1 = url.split("/");
- int i = s1.length; // s1เอามาหาindex
- String s2 = s1[i-1];
- if(s2.startsWith(""))
- return "_" + s2.substring(1);
- else
- return s2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment