Description
We already have STRLWR
and STRUPR
, for lowercase
and UPPERCASE
. However, I'd like a couple more functions, for CamelCase
and snake_case
(and maybe Title_Case
). The goal would be to allow transforming between conventional CONSTANT_NAMES
and LabelNames
, so macros wouldn't need to be passed both variants. E.g. you could do map_mac CeruleanCity
and then internally it could do db CERULEAN_CITY_MAP_ID
as well as dw CeruleanCityNPCData
.
I haven't fully thought out the edge cases of how these functions would work, beyond "keep them ASCII-only" (since STRLWR
and STRUPR
are ASCII-only too, and symbol names can only be ASCII anyway). But the Rust paste!
macro (a more powerful version of concat_idents!
) can be used for reference: https://docs.rs/paste/latest/paste/#case-conversion
See also guess_map_constant
in Polished Map, which tries to derive a CONSTANT_NAME
from the ConstantName.blk
filename it's given. It handles at least some edge cases, like DarkCaveB3F
becoming DARK_CAVE_B3F
.