1
0
Fork 0

Document hyphens being replaced with spaces in `String.capitalize()`

This commit is contained in:
Hugo Locurcio 2026-01-23 20:19:28 +01:00
parent c3058391d7
commit fff6469d5b
No known key found for this signature in database
GPG Key ID: 46ACE49F61685096
1 changed files with 3 additions and 1 deletions

View File

@ -92,17 +92,19 @@
<method name="capitalize" qualifiers="const">
<return type="String" />
<description>
Changes the appearance of the string: replaces underscores ([code]_[/code]) with spaces, adds spaces before uppercase letters in the middle of a word, converts all letters to lowercase, then converts the first one and each one following a space to uppercase.
Returns a copy of the string with changed appearance. Replaces underscores ([code]_[/code]) and hyphens ([code]-[/code]) with spaces, adds spaces before uppercase letters in the middle of a word, converts all letters to lowercase, then converts the first one and each one following a space to uppercase.
[codeblocks]
[gdscript]
"move_local_x".capitalize() # Returns "Move Local X"
"sceneFile_path".capitalize() # Returns "Scene File Path"
"2D, FPS, PNG".capitalize() # Returns "2d, Fps, Png"
"example-name".capitalize() # Returns "Example Name"
[/gdscript]
[csharp]
"move_local_x".Capitalize(); // Returns "Move Local X"
"sceneFile_path".Capitalize(); // Returns "Scene File Path"
"2D, FPS, PNG".Capitalize(); // Returns "2d, Fps, Png"
"example-name".Capitalize(); // Returns "Example Name"
[/csharp]
[/codeblocks]
</description>