How to write data on multiple lines BUT within the same cell of csv?

后端 未结 5 956
深忆病人
深忆病人 2020-12-15 19:24

I want to create one csv file using C#.

I have some data which I want to write on multiple lines BUT within the same cell.

For example If I have following t

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 20:18

    string input = "...";
    
    var r = input.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries) // split by dot (have you any better approaches?)
                 .Select(s => String.Format("\"{0}.\"", s.Trim())); // escape each with quotes
    
    input = String.Join(Environment.NewLine, r); // break by line break
    

提交回复
热议问题