String source
Transform string values with built-in string operations inside a Smart String.
Read time 1 minuteLast updated 10 days ago
Transform string values with built-in string operations inside a Smart String.
The String source handles a value and exposes common string operations as selectors, so you can transform text directly in the format string. For example, outputs the value of in uppercase.
string{name.ToUpper}nameSelector | Description |
|---|---|
| The number of characters in the string. |
| Convert to upper or lower case using the active culture. |
| Convert to upper or lower case using the invariant culture. |
| Remove surrounding whitespace. |
| Convert the first character to upper case. |
| Convert the first letter of each word to upper case. |
| Convert the string to a character array. |
| 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:
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 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.