[RUBY] Supports 0 drop in CSV output

Introduction

This is about how to deal with the problem that 0 is omitted and 1 is output when trying to CSV output a numerical value such as 001 that starts with 0.

Correspondence

'="001"'

If it is a fixed value, this is not a problem, but if it is a variable, the expression is not expanded, so do as follows.

#Note that it is enclosed in double quotes
%Q{="#{hoge}"}

Rubocop compliant,

#Note that it is enclosed in double quotes
%(="#{hoge}")

Recommended Posts

Supports 0 drop in CSV output
Try scraping about 30 lines in Java (CSV output)
Output triangle in Ruby
Output in multiples of 3
Csv output processing using super-csv
Output Rails Routes as csv
Output JavaScript in Thymeleaf 3 without escaping
[Ruby on Rails] CSV output function
Mixed Western calendar output in Java
String output method memo in Ruby
Log output to file in Java
Output JUnit test report in Maven
Implement CSV download function in Rails