From fff6469d5bee3d336c0dfcebd230d1ec71c7d571 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 23 Jan 2026 20:19:28 +0100 Subject: [PATCH] Document hyphens being replaced with spaces in `String.capitalize()` --- doc/classes/String.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 3a750203d7b..8994f7b796b 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -92,17 +92,19 @@ - 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]