Implicit char to string v2 #1420
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #998 and surpasses #999.
(Can either be for Beta3 or Beta4, whatever suits us best)
We again have three parts, but slightly modified from #999:
String
-fallback forChar
inconvert
We get
String
-fallback forChar
columns indf.convert().to<>()
... andcol.convertTo<X>()
. This means you can now do things like:Note: We do keep the old
convert
behavior ofChar
->Int
by ASCII code. This is in line with the JVM world. We have parsing now if you want theChar
'1'
to turn into theInt
1
.Converting from
String
columns can only result in enum instances (like above), value class instances, or callparse()
, so we follow the same behavior forChar
columns now.Char
parsingdf.parse()
now not only parses string columns, but also char ones (this can be changed if you don't agree, of course).We also gain:
Here I deviate from #999, as
because the parsing didn't do anything. However similar to
String
columns, there'stryParse()
which can return the same type as the input.convertTo<> { parser {} }
Char
supportFixes #998 by trying out all provided
String
converters ifChar
s are encountered without a converter.I also updated the docs and expanded upon
convertTo
a lot to prevent confusion, like what was experienced in #998.