Computer Science Canada Removing multiple spaces and performing a wordcount on a text file |
Author: | yazdmich [ Fri Oct 26, 2012 6:06 pm ] | ||
Post subject: | Removing multiple spaces and performing a wordcount on a text file | ||
What is it you are trying to achieve? Remove multiple spaces from a text file What is the problem you are having? Spaces are not removed Describe what you have tried to solve this problem Loops, different if statements Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) see attached file for the text to be parsed
Please specify what version of Turing you are using OpenTuring 1.1 |
Author: | Dreadnought [ Fri Oct 26, 2012 10:32 pm ] | ||
Post subject: | Re: Removing multiple spaces and performing a wordcount on a text file | ||
Consider this:
|
Author: | evildaddy911 [ Sat Oct 27, 2012 1:02 pm ] |
Post subject: | RE:Removing multiple spaces and performing a wordcount on a text file |
for the multiple spaces: don't restrict yourself to a max of 3 spaces in a row. for the wordcount, determine what characters separate each word. eg. should "joe-bob" count as 1 or or 2? should "joe.bob" count as 1 word or 2? How many for "Joe. Bob"? simply count up the number of those characters and there you go |