Code example for StringTokenizer

Methods: countTokensnextToken

0
			   //no rows empty cursor 
			   return; 
			} 
						 
			final String street = cur.getString(cur.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.StructuredPostal.FORMATTED_ADDRESS));
			StringTokenizer token=new StringTokenizer(street, ",");
			boolean latlong=false;
			String latitude=null;
			String longitude=null;
			if(token.countTokens()==2){
				String temp=token.nextToken();
				if(temp.startsWith("loc:")){
					temp=temp.substring(4);
				} 
				 if (temp.trim().matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) {  
			            latitude=temp.trim();
			        }  
				 temp=token.nextToken();
				 if(temp.trim().matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")){
					 longitude= temp.trim();
				 }  
				 if(latitude!=null && longitude!=null){
					 latlong=true;
Stop searching for code, let great code find you!  Add Codota to your java IDE