coalib.bearlib.naming_conventions package

Module contents

coalib.bearlib.naming_conventions.to_camelcase(string)[source]

Converts the given string to camel-case.

>>> to_camelcase('Hello_world')
'helloWorld'
>>> to_camelcase('__Init__file__')
'__initFile__'
>>> to_camelcase('')
''
>>> to_camelcase('alreadyCamelCase')
'alreadyCamelCase'
>>> to_camelcase('   string')
'___string'
Parameters:string – The string to convert.
Returns:The camel-cased string.
coalib.bearlib.naming_conventions.to_kebabcase(string)[source]

Converts the given string to kebab-case.

>>> to_kebabcase('HelloWorld')
'hello-world'
>>> to_kebabcase('__Init__File__')
'init-file'
>>> to_kebabcase('')
''
>>> to_kebabcase('already-kebab-case')
'already-kebab-case'
>>> to_kebabcase('   string  ')
'string'
>>> to_kebabcase('ABCde.F.G..H..IH')
'a-b-cde.f.g..h..i-h'
Parameters:string – The string to convert.
Returns:The kebab-cased string.
coalib.bearlib.naming_conventions.to_pascalcase(string)[source]

Converts the given to string pascal-case.

>>> to_pascalcase('hello_world')
'HelloWorld'
>>> to_pascalcase('__init__file__')
'__InitFile__'
>>> to_pascalcase('')
''
>>> to_pascalcase('AlreadyPascalCase')
'AlreadyPascalCase'
>>> to_pascalcase('   string')
'___String'
Parameters:string – The string to convert.
Returns:The pascal-cased string.
coalib.bearlib.naming_conventions.to_snakecase(string)[source]

Converts the given string to snake-case.

>>> to_snakecase('HelloWorld')
'hello_world'
>>> to_snakecase('__Init__File__')
'__init_file__'
>>> to_snakecase('')
''
>>> to_snakecase('already_snake_case')
'already_snake_case'
>>> to_snakecase('   string  ')
'___string__'
>>> to_snakecase('ABCde.F.G..H..IH')
'a_b_cde.f.g..h..i_h'
Parameters:string – The string to convert.
Returns:The snake-cased string.
coalib.bearlib.naming_conventions.to_spacecase(string)[source]

Converts the given string to space-case.

>>> to_spacecase('helloWorld')
'Hello World'
>>> to_spacecase('__Init__File__')
'Init File'
>>> to_spacecase('')
''
>>> to_spacecase('Already Space Case')
'Already Space Case'
>>> to_spacecase('  string  ')
'String'
Parameters:string – The string to convert.
Returns:The space-cased string.