Code example for StringTokenizer

Methods: hasMoreTokensnextToken

0
		// Eliminate ']' and '[' 
		newRequestLine = newRequestLine.replace('[', ' ');
		newRequestLine = newRequestLine.replace(']', ' ');
		 
		// Now parse the response line 
		st = new StringTokenizer(newRequestLine, " ");
		httpVersion = st.nextToken();
		try { 
			statusCode = Integer.parseInt(st.nextToken());
		} catch (NumberFormatException ex) {
			// TODO: 
		} 
		if(st.hasMoreTokens())
			reasonPhase = st.nextToken();
	} 
	public String toString() {
		return(httpVersion + " " + statusCode.toString() +" " + reasonPhase);
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE