|
133 | 133 | function write_vals!(a, pos, ::Missing) |
134 | 134 | pos |
135 | 135 | end |
| 136 | +function write_vals!(a, pos, ::Nothing) |
| 137 | + pos |
| 138 | +end |
136 | 139 |
|
137 | 140 |
|
138 | 141 | function write_vals!(a, pos, x::AbstractString) |
@@ -183,15 +186,18 @@ function write_quotechar!(a, pos, quotechar) |
183 | 186 | a[pos] = quotechar |
184 | 187 | pos+1 |
185 | 188 | end |
186 | | - |
| 189 | +function write_quotechar!(a, pos, ::Nothing) |
| 190 | + pos |
| 191 | +end |
187 | 192 |
|
188 | 193 |
|
189 | 194 | function _base!(a, pos, base::Integer, x::Integer, pad::Int, neg::Bool) |
190 | 195 | (x >= 0) | (base < 0) || throw(DomainError(x, "For negative `x`, `base` must be negative.")) |
191 | 196 | 2 <= abs(base) <= 62 || throw(DomainError(base, "base must satisfy 2 ≤ abs(base) ≤ 62")) |
192 | 197 | b = (base % Int)::Int |
193 | 198 | digits = abs(b) <= 36 ? Base.base36digits : Base.base62digits |
194 | | - n = neg + ndigits(x, base=b, pad=pad) |
| 199 | + # pad = 0 makes issue when x == 0 (n will be 0) |
| 200 | + n = neg + ndigits(x, base=b) |
195 | 201 | i = n |
196 | 202 | @inbounds while i > neg |
197 | 203 | if b > 0 |
@@ -222,7 +228,11 @@ function _op_for_row_join!(buffer, currentpos, y, f, delim, quotechar, idx, p) |
222 | 228 | end |
223 | 229 | end |
224 | 230 | else |
225 | | - quotecharval = UInt8(quotechar) |
| 231 | + if nonmissingtype(eltype(y)) <: AbstractString |
| 232 | + quotecharval = UInt8(quotechar) |
| 233 | + else |
| 234 | + quotecharval = nothing |
| 235 | + end |
226 | 236 | if idx[]<p |
227 | 237 | Threads.@threads for i in 1:length(y) |
228 | 238 | currentpos[i] = write_quotechar!(view(buffer, :, i), currentpos[i], quotecharval) |
|
0 commit comments