Trying to replace a different amount of spaces with only one comma

I have a data array with multiple rows that I'm trying to output to a `CSV` file. The input file has a different amount of blank spaces between columns so the columns don't match up with the cells in the excel spreadsheet. When I write, output.WriteLine(s.Replace(" ", ",")); it takes away all blank spaces and replace them with commas making the csv file look terrible. I was wondering if there was a way I could loop through get rid of all the blank spaces and replace them with only one comma instead of many. Any help would be great.
You need to make use of regular expressions

以上就是Trying to replace a different amount of spaces with only one comma的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏