> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/string/upperfirst.md).

# \_.upperFirst（仅首字母大写其他不变）

**语法：**

```javascript
_.upperFirst([string=''])
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L15191)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.upperfirst)

**描述：**

转换字符串`string`的首字母为大写。

**开始版本：**&#x34;.0.0

**参数：**

* `[string=''] (string)`: 要转换的字符串。

**返回值：**

* `(string)`: 返回转换后的字符串。

**例子：**

```javascript
_.upperFirst('fred');
// => 'Fred'

_.upperFirst('FRED');
// => 'FRED'
```
