View Single Post
Old Jun 27th, 2005, 5:28 PM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Lets say you have String a:

String [] temp = a.split(" ");
System.out.println(temp.length);

That would be an easy way to do it. You could look through and count if you wanted, as well with a loop.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower

Last edited by Mjordan2nd; Jun 27th, 2005 at 5:38 PM.
Mjordan2nd is offline   Reply With Quote