【发布时间】:2020-05-07 19:11:36
【问题描述】:
Tcl 文档中明确说明了如何使用string totitle:
返回一个等于 string 的值,除了第一个字符 string 被转换为它的 Unicode 标题大小写变体(或大写 如果没有标题大小写变体)并且字符串的其余部分是 转换为小写。
是否有一种解决方法或方法可以转换带有空格的字符串(每个单词的第一个字母大写)?
例如在Python:
intro : str = "hello world".title()
print(intro) # Will print Hello World, notice the capital H and W.
【问题讨论】: