Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static string[] ConcatLessThan1k(string[] source) =>
- source.Aggregate((list:new List<string>(), bld :new StringBuilder()), (state, txt) =>
- {
- if (state.bld.Length + txt.Length >= 1000)
- {
- state.list.Add(state.bld.ToString());
- state.bld.Clear();
- }
- else
- {
- state.bld.Append(txt);
- }
- return state;
- }, state => state.list.ToArray());
Add Comment
Please, Sign In to add comment