Click here to Skip to main content
15,886,639 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I think I may have to split strings to be able to do this process but i'm not too sure for example in the text file the numbers are positioned like

George 3 12
and i want to multiply the 3 by 12 so does anyone have any ideas on how I could do this
thanks
Posted

1 solution

You will need to split out the three (or more) items, convert them to numeric values, and then multiply them.
This smells like homework, so I'll give you no code!
But this should help: http://www.tutorialspoint.com/java/java_string_split.htm[^], and so should this: http://www.tutorialspoint.com/java/number_parseint.htm[^]
 
Share this answer
 
Comments
Adamdew93 29-May-15 7:18am    
will using a scanner to read the file make it more complicated or does that not matter
Maciej Los 29-May-15 9:09am    
It's unrelated. String is string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900