Skip to content

Commit 89a2863

Browse files
authored
Update basic-types.md (#23)
1 parent 350f656 commit 89a2863

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/basic-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ String is one of the most widely used data types in programming languages, maste
7171
| Check if a string ends with a specified character(s) | `myStr.endsWith(suffix)` | `my_str.endswith(suffix)` |
7272
| Trim whitespace from both ends of a string | `myStr.trim()` | `my_str.strip()` |
7373
| Center align a string with a specified width | - | `my_str.center(width)` |
74-
| Capitalize the first letter of the first word | - | `my_str.capitalize()` |
75-
| Capitalize the first letter of each word | - | `my_str.title()` |
74+
| Capitalize the first letter of the first word | `myStr.replace(myStr[0], myStr[0].toUpperCase())` | `my_str.capitalize()` |
75+
| Capitalize the first letter of each word | `myStr.replace(/(^\w{1})\|(\s+\w{1})/g, s => s.toUpperCase())` | `my_str.title()` |
7676

7777
### Resources
7878
- https://docs.python.org/3/library/stdtypes.html

0 commit comments

Comments
 (0)