[issue40437] add string.snake function

jeffolsi10 report at bugs.python.org
Wed Apr 29 12:06:31 EDT 2020


jeffolsi10 <yirage2897 at coalamails.com> added the comment:

I'd like also to point that there are few other cases:
https://stackoverflow.com/questions/11273282/whats-the-name-for-hyphen-separated-case

This is PascalCase: SomeSymbol
This is camelCase: someSymbol
This is snake_case: some_symbol

So a possible function could be:

convert_case(string, input_format, output_format)
for example:

convert_case(someSymbol, input_format='camelCase', output_format='snake_case')
output: some_symbol

It should be noted that you can not convert something without knowing what it is.
so something like : convert('helloworld','camelCase') can not be done because you don't know where one first word start and when one ends.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40437>
_______________________________________


More information about the Python-bugs-list mailing list