> For the complete documentation index, see [llms.txt](https://supernova-developers.gitbook.io/supernova-dsm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://supernova-developers.gitbook.io/supernova-dsm/pulsar-language/transformers/string-transformers.md).

# String Transformers

String transformers can be used on a value data type of `string`, including a string coming from other transformers, such as `.first()` item of an array. Following transformers are available:

## `lowercased`

Returns lowercased string:

* Usage: `.lowercased()`
* Example usage: `value.lowercased()`
* Example: `Space Is Awesome` to `space is awesome`

## `uppercased`

Returns uppercased string:

* Usage: `.uppercased()`
* Example usage: `value.uppercased()`
* Example: `Falcon` to `FALCON`

## `prefixed`

Returns string prefixed with the given string. `prefix` must be a string value.

* Usage: `.prefixed(prefix)`
* Example usage: `value.prefixed("This")`
* Example return: `value` to `This value`

## `suffixed`

Returns string suffixed with the given `suffix`. `suffix` must be a string value.

* Usage: `.suffixed(suffix)`
* Example usage: `value.suffixed("That")`
* Example return: `extends` to `extends That`

## `extended`

Returns string extended with prefix and suffix. `prefix` and `suffix` must both be string values.

* Usage: `.extended(prefix, suffix)`
* Example usage: `value.extended("This", "That")`
* Example return: `extends` to `This extends That`

## `capitalized`

Returns string with the first letter uppercased.

* Usage: `.capitalized()`
* Example usage: `value.capitalized()`
* Example return: `this and that` to `This And That`

## `snakecased`

Returns string in [snake case](https://en.wikipedia.org/wiki/Snake_case) representation.

* Usage: `.snakecased()`
* Example usage: `value.snakecased()`
* Example return: `This and that` to `this_and_that`

## `camelcased`

Returns string in [camel case](https://en.wikipedia.org/wiki/Camel_case) representation. If `isCapitalized` is `true`, the first letter of the source is capitalized, otherwise lowercase letter returns.

* Usage: `.camelcased(isCapitalized)`
* Example usage: `value.camelcased(false)`
* Example return: `This and that` to `thisAndThat`

or

* Example usage: `value.camelcased(true)`
* Example return: `This and that` to `ThisAndThat`

## `replacing`

Returns the source with all occurrences of provided substring replaced with another string. `search` and `replace` must both be `String` values.

* Usage: `.replacing(search, replace)`
* Example usage: `value.replacing("Tom", "John")`
* Example return: `Tom is a boy` to `John is a boy`

## `trimming`

Returns the source with left and right-trimmed control character. `value` must be a string value.

* Usage: `.trimming(value)`
* Example usage: `value.trimming("o")`
* Example return: `ouzo` to `uz`&#x20;

## `trimmingSpaces`

Returns the source with left and right-trimmed spaces.

* Usage: `.trimmingSpaces()`
* Example usage: `value.trimmingSpaces()`
* Example return: `Tom` to `Tom`&#x20;

## `slashNewlines`

Replaces all occurrences of newlines with \n character, producing a code-safe string.

* Usage: `.slashNewlines()`
* Example usage: `value.splashNewlines()`
* Example return: `Tom is \n Awesome` to `Tom is \\n Awesome`&#x20;

## `slashSingleQuotes`

Replaces all occurrences of `'` with \\' character, producing a code-safe string.

* Usage: `.slashSingleQuotes()`
* Example usage: `value.slashSingleQuotes()`
* Example return: `Tom's hat` to `Tom\'s hat`&#x20;

## `slashDoubleQuotes`

Replaces all occurrences of `"` with \\" character, producing a code-safe string.

* Usage: `.slashDoubleQuotes()`
* Example usage: `value.slashDoubleQuotes()`
* Example return: `Tom's "hat"` to `Tom's \"hat\"`&#x20;

## `split`

Returns array of strings made by splitting the source using `separator`. `separator` can be multiple characters, must be a string.

* Usage: `.split(separator)`
* Example usage: `value.split("|")`
* Example return: `this|that|those` to `["this", "that", "those"]`

## `contains`

Returns true if the string contains another substring, otherwise false. Case sensitive search.

* Usage: `.contains(substring)`
* Example usage: `value.contains("X")`
* Example return: `"SpaceX"` to  `true`

## `startsWith`

Returns true if the beginning of the string is provided substring, otherwise false. Case sensitive search.

* Usage: `.startsWith(substring)`
* Example usage: `value.startsWith("S")`
* Example return: `"SpaceX"` to  `true`

## `endsWith`

Returns true if the end of the string is provided substring, otherwise false. Case sensitive search.

* Usage: `.endsWith(substring)`
* Example usage: `value.startsWith("X")`
* Example return: `"SpaceX"` to  `true`

## `splitExpr`

Returns array of strings made by splitting the source using `expression`. `expression` must be a valid regexp.

* Usage: `.splitExpr(expression)`
* Example usage: `value.split("\\s+")`
* Example return: `this and that` to `["this", "and", "that"]`

## `splitNewlines`

Returns array of strings made by splitting the source using `"\n"`.&#x20;

* Usage: `.splitNewlines()`
* Example usage: `value.splitNewlines`
* Example return: `this\nthat` to `["this", "that"]`

## `substring`

Returns substring by initial `location` and `length`. `location` and `length` must be `Int`. When the location is out of bounds, an empty string is returned. When length + location is out of bounds, substring until the end of the original string will be returned.

* Usage: `.substring(location, length)`
* Example usage: `value.substring(1, 3)`
* Example return: `words` to `ord`

## `default`

Outputs the default value if the source value is nil or empty. `value` must be a string value.

* Usage: `.default(value)`
* Example usage: `value.default("Empty")`
* Example return:  `nil` to `Empty`

## `count`

Returns the length of the string. Works well with things like emojis and other complex characters, properly counting them as one character.

* Usage: `.count()`
* Example usage: `value.count()`
* Example return: `Bob` to `3`&#x20;

## `formatDate`

Outputs formatted string which was created from the input date.&#x20;

Note that the source value must be of ISO8601 format (either `yyyy-MM-dd'T'HH:mm:ssZ` or `yyyy-MM-dd'T'HH:mm:ss.SSSZ` is accepted).

* Usage: `.formatDate(format)`
* Example usage: `value.formatDate("YYYY-MM-DD")`
* Example return: `2020-04-21T07:26:31.500Z` to `2020-04-21`&#x20;
