Asked By Peter Duniho
08-Oct-08 02:44 PM

First, you need to decide what you mean by "word". Then, you need to scan
through the string looking for words. As you find a complete word, you
then need to append the word to a new string, unless doing so would cause
that new string to exceed your limit of 120 characters, in which case
you're done.
The original string can be a String. Scanning can be done explicitly
yourself one character at a time, or if you don't mind scanning the entire
input all at once before actually processing the words, you can use the
String.Split() method. For the purpose of creating the new string as you
go along, I recommend the StringBuilder class.
Note that if you want to preserve the delimiting characters between words
in your output, you'll need to do the scan explicitly rather than using
String.Split(), so that you have access to those characters and can also
append them to your output.
We could just write the code for you but, frankly, we're not on your
payroll and it seems like you ought to go ahead and do _some_ of the work
yourself. :)
Pete