Guest User

Untitled

a guest
Dec 15th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. static string[] ConcatLessThan1k(string[] source) =>
  2. source.Aggregate((list:new List<string>(), bld :new StringBuilder()), (state, txt) =>
  3. {
  4. if (state.bld.Length + txt.Length >= 1000)
  5. {
  6. state.list.Add(state.bld.ToString());
  7. state.bld.Clear();
  8. }
  9. else
  10. {
  11. state.bld.Append(txt);
  12. }
  13.  
  14. return state;
  15. }, state => state.list.ToArray());
Add Comment
Please, Sign In to add comment