Skip to content

Commit 147dc39

Browse files
committed
split func added
1 parent 3b9a074 commit 147dc39

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

export.rb

+27-6
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,37 @@
66

77

88
# read the file
9+
# code_map = <<END_CODE
10+
# Case/card # cols 1-4
11+
# Card Start Width Items Total Variable
12+
# No. Col. Cols.
13+
# END_CODE
914

1015
FasterCSV.foreach(CSV_FILE_PATH, :headers => true, :header_converters => :symbol) do |line|
11-
for n in 1..15
12-
p line[n]
16+
ascii = line[:id] + ' '
17+
code_map = ""
18+
start_col = 6
19+
item = 1
20+
for n in 1..16
21+
if line[n]
22+
23+
line[n].split("|").each{ |unit| ascii += unit}
24+
25+
26+
ascii += line[n]
27+
start_col += line[n-1].length * item unless n == 1
28+
item if line[n].split("|" ,)
29+
#code_map += line[:id] +" " + start_col.to_s + " " + line[n].length.to_s + " " + item.to_s + line[:header] + '\n'
30+
end
1331
end
14-
15-
p line[:id] + " " + line[:q1] + line[:q2] + line[:q3] + line[:q4] + line[:q5] + line[:q6]
32+
p ascii
33+
p code_map
34+
p start_col
1635

17-
end
18-
36+
end
37+
38+
39+
1940
# DATA = File.read(CSV_FILE_PATH)
2041
#
2142
# table = FCSV.parse(DATA, :headers => true, :header_converters => :symbol)

0 commit comments

Comments
 (0)