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


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
