Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
May 11, 2012 05:26 PM|LINK
TIMTOWTDI =. there is more than one way to do it
one approach that comes to mind, in pseudo-code, is this.
(a) create List<String> or String workingList as the set of non empty strings from your input string
http://msdn.microsoft.com/en-us/library/b873y76a.aspx "String.Split Method (Char)"
(b) have a List<string> result_strings with zero entries
(c) have a String that is empty
(d) foreach through the workingList ... keep adding parts to the empty string as long as it will not exceed 11 bytes in length
(e) if the next part will exceed length == 11, add the current part to your result_strings and start your next part with your String from (c) set back to String.Empty..
(f) watch for the special case where any individual part is >= 11 bytes.
(g) remember to append a space between all concatenated parts.
P.S.: just curious, is this a homework assignment?