Add Options, Functions and Settings to convert Node-Names and Strings to kebab-case

- refactored and renamed String::_camelcase_to_underscore to String:_separate_compound_words
- refactored String::to_snake_case to work with the refactored String::_separate_compound_words
- created char_utils::is_hyphen to catch all hyphen variants in kebab-case conversion
- created String::to_kebab_case using the new String::_separate_compound_words
- created corresponding Documentation in String and StringName
- simplified both switch statements in EditorNode and ProjectDialog
- added new kebab-casing Option for Node Names in ProjectSettings
- added missing camelCase Options to Scene- and Node-Names in ProjectSettings
- simplified Mono RuntimeInterop Functions
- hooked up the ConnectionsDialog
- created additional Unit Tests
This commit is contained in:
Priahoud 2024-07-28 21:32:28 +02:00 committed by priahoud
parent 06c71fbf40
commit bf963e767e
20 changed files with 195 additions and 114 deletions

View file

@ -1040,6 +1040,25 @@
[/codeblock]
</description>
</method>
<method name="to_kebab_case" qualifiers="const">
<return type="String" />
<description>
Returns the string converted to [code]kebab-case[/code].
[b]Note:[/b] Numbers followed by a [i]single[/i] letter are not separated in the conversion to keep some words (such as "2D") together.
[codeblocks]
[gdscript]
"Node2D".to_kebab_case() # Returns "node-2d"
"2nd place".to_kebab_case() # Returns "2-nd-place"
"Texture3DAssetFolder".to_kebab_case() # Returns "texture-3d-asset-folder"
[/gdscript]
[csharp]
"Node2D".ToKebabCase(); // Returns "node-2d"
"2nd place".ToKebabCase(); // Returns "2-nd-place"
"Texture3DAssetFolder".ToKebabCase(); // Returns "texture-3d-asset-folder"
[/csharp]
[/codeblocks]
</description>
</method>
<method name="to_lower" qualifiers="const">
<return type="String" />
<description>