Closed ttytm closed 4 days ago
Related to this and potential simplifications, would a .is_upper
/ .is_lower
method for chars make it as a builtin?
We have u8.is_capital/0 already, which does c >= A
&& c <= Z
, but I could not find a separate implementation for u8.is_lower/0 .
Bug in code:
assert '_ISspace'.camel_to_snake() == '_i_sspace'
but got '__sspace'
lost the first char I
Good catch. Thanks a lot for the test cases @kbkpbot
Why assert '_ISspace'.camel_to_snake() == '_i_sspace'
?
I would have expected _ISspace
to become _is_space
🤔 .
Good question. From the short research I did before, the initial implementation (without extracting handling of the first characters to reduce the load in the loop) was very similar to the implementation at https://github.com/iancoleman/strcase. So the initial impl and Go's strcase gives _i_sspace
:thinking: .
Ref.: https://github.com/vlang/v/pull/21691#issuecomment-2184905360