[问题] 字符串从驼峰转换为蛇形时没有按照预期实现
作者: HolySSSSShit创建于 2026年6月3日更新于 2026年7月25日
标签question
The rules for converting strings from camel case to snake case seem to be a bit problematic. According to the standard of snake case naming, each "segment" should be an independent entity that expresses a meaning. For example, "over_50k" means more than 50,000. When trying to convert "over50k" to snake case, the result is still "over50k" instead of the expected "over_50k". I looked at the snake method in stringable, which explicitly uses regular expression matching [A-Z], but here "50k" is also a unit, so I think the "segment" at the beginning of the number should be handled.
内容来源: hyperf/hyperf