I would like to cut my string "ftp://user:password@ftp.domain.com:21"
to have each article in a string
in other words, I want to have:
String ftp = "ftp.domain.com"
String user = "user"
String password = "password"
String port = "21"
This code that works but it's a little dirty, right?
String fullFtpAdress = "ftp://user:password@ftp.domain.com:21";
fullFtpAdress = fullFtpAdress.substring(6);
String[] parts1 = fullFtpAdress.split(":",2);
String user = parts1[0];
String[] parts2 = parts1[1].split("@");
String password = parts2[0];
String[] parts3 = parts2[1].split(":");
String ftp = parts3[0];
String port = parts3[1];
Do you have another solution?
Thank you :)