Hello all, I have a quick question I would like to ask.
I have been given an exercice where I have addresses, and I have to extract the ZIP code on it. Here it is
So I basically need to get the 750.. into a variable and then print it. How may I do that?
Thanks a lot
I have been given an exercice where I have addresses, and I have to extract the ZIP code on it. Here it is
class Assignement6 { public static void main (String []args) { String Address[] = {"17, 3FR, Rue Bonaparte, 75001", "9, 4FL, Rue Joseph Bara, 75006", "85, 2FL, Rue Rivoli, 75004", "75, 4FR, Rue De L'Opera, 75012", "29, 9FR, Rue Port-Royal, 75018", "59, 1FL, Rue Pierre Nicole, 75005", "58, 7FR, Rue Monge, 75002", "15, 6FR, Rue Voltaire, 75006", "111, 13FL, Rue Auguste, 75004", "53, 4FR, Rue Des Saints-Pere, 75008"}; String ZIPStr; //variable to hold zip as a string int ZIPInt; //variable to hold zip as int for(int i=0; i<Address.length; i++) { ZIPStr= Address[i].length-6; } System.out.println(ZIPStr); } }
So I basically need to get the 750.. into a variable and then print it. How may I do that?
Thanks a lot