TranslateTool.PoWriter.SplitLines C# (CSharp) Method

SplitLines() private method

private SplitLines ( string s ) : List
s string
return List
        private List<string> SplitLines(string s)
        {
            List<string> list = new List<string>(s.Split(new string[] {"\r\n"}, StringSplitOptions.None));
            for (int i = 0; i < list.Count - 1; ++i)
                list[i] = list[i] + "\n";

            for (int i = 0; i < list.Count; ++i) {
                if (list[i].Length > 60) {
                    int splitAt = 60;
                    for (int index = splitAt - 2; index > 0; --index) {
                        if (list[i][index] == ' ') {
                            splitAt = index + 1;
                            break;
                        }
                    }

                    list.Insert(i + 1, list[i].Substring(splitAt));
                    list[i] = list[i].Substring(0, splitAt);
                }
            }

            list.RemoveAll(x => (x.Length == 0));      // remove empty strings

            return list;
        }