> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/string/ucfirst.md).

# UCFirst

Transform the first letter of a string to uppercase or the first letter of each word, and optionally lowercase uppercase characters.

## Method Signature

```
UCFirst(string=[string], doAll=[boolean], doLowerIfAllUppercase=[boolean])
```

### Arguments

| Argument                | Type      | Required | Description                                                                 | Default |
| ----------------------- | --------- | -------- | --------------------------------------------------------------------------- | ------- |
| `string`                | `string`  | `true`   | The string to transform.                                                    |         |
| `doAll`                 | `boolean` | `false`  | Boolean flag indicating whether to transform the first letter of each word. | `false` |
| `doLowerIfAllUppercase` | `boolean` | `false`  | Boolean flag indicating whether to lowercase uppercase characters.          | `false` |

## Examples

### Basic usage

Capitalizes the first character of the first word only.

[Run Example](https://try.boxlang.io/?code=eJwrTXbLLCou0VBQykjNyclXKM8vyklRVFLQtOYCAIPJCHg%3D)

```java
ucFirst( "hello world!" );

```

Result: Hello world!

### Capitalize all the words in string

Using the optional doAll parameter capitalizes the first character of all words. Word separators are: whitespace, period, parenthesis, or dash.

```java
ucFirst( "boxlang.ortusbooks.com is your (everyone's) resource for BX-related documentation!", true );

```

Result: boxlang.ortusbooks.com Is Your (everyone's) Resource For BX-related Documentation!

### Handling of strings in all uppercase

Using the optional doLowerIfAllUppercase parameter allows for intelligent capitalization of words in all caps.

```java
ucFirst( "boxlang.ortusbooks.com YOUR (EVERYONE'S) RESOURCE FOR BX-related DOCUMENTATION!", true, true );

```

Result: boxlang.ortusbooks.com Your (everyone's) Resource For BX-related Documentation!

### Additional Examples

```java
string = "submitting bugs and feature requests via our online system";
dump( UcFirst( string, false, false ) );
dump( UcFirst( string, true, false ) );

```

## Related

* [Ascii](/boxlang-language/reference/built-in-functions/string/ascii.md)
* [CamelCase](/boxlang-language/reference/built-in-functions/string/camelcase.md)
* [Char](/boxlang-language/reference/built-in-functions/string/char.md)
* [CharsetDecode](/boxlang-language/reference/built-in-functions/string/charsetdecode.md)
* [CharsetEncode](/boxlang-language/reference/built-in-functions/string/charsetencode.md)
* [Compare](/boxlang-language/reference/built-in-functions/string/compare.md)
* [CompareNoCase](/boxlang-language/reference/built-in-functions/string/comparenocase.md)
* [Find](/boxlang-language/reference/built-in-functions/string/find.md)
* [FindNoCase](/boxlang-language/reference/built-in-functions/string/findnocase.md)
* [FindOneOf](/boxlang-language/reference/built-in-functions/string/findoneof.md)
* [Insert](/boxlang-language/reference/built-in-functions/string/insert.md)
* [JSStringFormat](/boxlang-language/reference/built-in-functions/string/jsstringformat.md)
* [Justify](/boxlang-language/reference/built-in-functions/string/justify.md)
* [KebabCase](/boxlang-language/reference/built-in-functions/string/kebabcase.md)
* [LCase](/boxlang-language/reference/built-in-functions/string/lcase.md)
* [Left](/boxlang-language/reference/built-in-functions/string/left.md)
* [ListReduce](/boxlang-language/reference/built-in-functions/string/listreduce.md)
* [LJustify](/boxlang-language/reference/built-in-functions/string/ljustify.md)
* [LTrim](/boxlang-language/reference/built-in-functions/string/ltrim.md)
* [Mid](/boxlang-language/reference/built-in-functions/string/mid.md)
* [ParagraphFormat](/boxlang-language/reference/built-in-functions/string/paragraphformat.md)
* [PascalCase](/boxlang-language/reference/built-in-functions/string/pascalcase.md)
* [QueryStringToStruct](/boxlang-language/reference/built-in-functions/string/querystringtostruct.md)
* [ReEscape](/boxlang-language/reference/built-in-functions/string/reescape.md)
* [ReFind](/boxlang-language/reference/built-in-functions/string/refind.md)
* [reFindNoCase](/boxlang-language/reference/built-in-functions/string/refindnocase.md)
* [ReMatch](/boxlang-language/reference/built-in-functions/string/rematch.md)
* [reMatchNoCase](/boxlang-language/reference/built-in-functions/string/rematchnocase.md)
* [RemoveChars](/boxlang-language/reference/built-in-functions/string/removechars.md)
* [RepeatString](/boxlang-language/reference/built-in-functions/string/repeatstring.md)
* [Replace](/boxlang-language/reference/built-in-functions/string/replace.md)
* [ReplaceList](/boxlang-language/reference/built-in-functions/string/replacelist.md)
* [ReplaceListNoCase](/boxlang-language/reference/built-in-functions/string/replacelistnocase.md)
* [ReplaceNoCase](/boxlang-language/reference/built-in-functions/string/replacenocase.md)
* [ReReplace](/boxlang-language/reference/built-in-functions/string/rereplace.md)
* [reReplaceNoCase](/boxlang-language/reference/built-in-functions/string/rereplacenocase.md)
* [Reverse](/boxlang-language/reference/built-in-functions/string/reverse.md)
* [Right](/boxlang-language/reference/built-in-functions/string/right.md)
* [RJustify](/boxlang-language/reference/built-in-functions/string/rjustify.md)
* [RTrim](/boxlang-language/reference/built-in-functions/string/rtrim.md)
* [Slugify](/boxlang-language/reference/built-in-functions/string/slugify.md)
* [SnakeCase](/boxlang-language/reference/built-in-functions/string/snakecase.md)
* [SpanExcluding](/boxlang-language/reference/built-in-functions/string/spanexcluding.md)
* [SpanIncluding](/boxlang-language/reference/built-in-functions/string/spanincluding.md)
* [SQLPrettify](/boxlang-language/reference/built-in-functions/string/sqlprettify.md)
* [StringBind](/boxlang-language/reference/built-in-functions/string/stringbind.md)
* [StringEach](/boxlang-language/reference/built-in-functions/string/stringeach.md)
* [StringEvery](/boxlang-language/reference/built-in-functions/string/stringevery.md)
* [StringFilter](/boxlang-language/reference/built-in-functions/string/stringfilter.md)
* [StringMap](/boxlang-language/reference/built-in-functions/string/stringmap.md)
* [StringReduce](/boxlang-language/reference/built-in-functions/string/stringreduce.md)
* [StringReduceRight](/boxlang-language/reference/built-in-functions/string/stringreduceright.md)
* [StringSome](/boxlang-language/reference/built-in-functions/string/stringsome.md)
* [StringSort](/boxlang-language/reference/built-in-functions/string/stringsort.md)
* [StripCR](/boxlang-language/reference/built-in-functions/string/stripcr.md)
* [Trim](/boxlang-language/reference/built-in-functions/string/trim.md)
* [TrueFalseFormat](/boxlang-language/reference/built-in-functions/string/truefalseformat.md)
* [UCase](/boxlang-language/reference/built-in-functions/string/ucase.md)
* [Val](/boxlang-language/reference/built-in-functions/string/val.md)
* [Wrap](/boxlang-language/reference/built-in-functions/string/wrap.md)
* [YesNoFormat](/boxlang-language/reference/built-in-functions/string/yesnoformat.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/string/ucfirst.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
