# String source

> Transform string values with built-in string operations inside a Smart String.

Transform string values with built-in string operations inside a Smart String.

The String source handles a `string` value and exposes common string operations as selectors, so you can transform text directly in the format string. For example, `{name.ToUpper}` outputs the value of `name` in uppercase.

| Selector                               | Description                                                 |
| -------------------------------------- | ----------------------------------------------------------- |
| `Length`                               | The number of characters in the string.                     |
| `ToUpper`, `ToLower`                   | Convert to upper or lower case using the active culture.    |
| `ToUpperInvariant`, `ToLowerInvariant` | Convert to upper or lower case using the invariant culture. |
| `Trim`, `TrimStart`, `TrimEnd`         | Remove surrounding whitespace.                              |
| `Capitalize`                           | Convert the first character to upper case.                  |
| `CapitalizeWords`                      | Convert the first letter of each word to upper case.        |
| `ToCharArray`                          | Convert the string to a character array.                    |
| `ToBase64`, `FromBase64`               | Encode to, or decode from, a UTF-8 Base64 string.           |

The following examples show how to use a few common string operations with the String source:

```cs
Smart.Format("{0.ToUpper}", "hello");                // "HELLO"
            Smart.Format("{0.Capitalize}", "hello");             // "Hello"
            Smart.Format("{0.CapitalizeWords}", "hello world");  // "Hello World"
            Smart.Format("Length: {0.Length}", "hello");         // "Length: 5"
```

* Selectors are matched case-insensitively unless case-sensitive matching is enabled in the settings. Refer to [Smart Strings settings reference](/engine/6000.7/manual/scripting/smart-strings/settings.md) for information on the different settings and how to enable them.
* Enable **Use Invariant Culture** on the source to always use the invariant culture. Otherwise, the active culture is used for case conversions.

## Additional resources

* [Properties source](/engine/6000.7/manual/scripting/smart-strings/sources/properties-source.md)
* [Smart Strings](/engine/6000.7/manual/scripting/smart-strings.md)
