# Class String

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [TopLevel.String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)

The String object represents any sequence of zero or more characters that are to be
treated strictly as text.

## Property Summary

| Property                                                                                              | Description                      |
| ----------------------------------------------------------------------------------------------------- | -------------------------------- |
| [length](#length): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) | The length of the String object. |

## Constructor Summary

| Constructor                                                                                                 | Description                                                |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| [String](#string)()                                                                                         | Constructs the String.                                     |
| [String](#stringnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)) | Constructs the String from the specified  Number object.   |
| [String](#stringstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Constructs a new String from the specified  String object. |

## Method Summary

| Method                                                                                                                                                                                                                                                                                                                                                                                | Description                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [charAt](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#charatnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                                   | Returns a string containing the character at position *index*.                                                                                                                 |
| [charCodeAt](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#charcodeatnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                           | Returns the UTF-16 code unit at the given position index.                                                                                                                      |
| [codePointAt](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#codepointatnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                         | Returns the Unicode code point at the given position index.                                                                                                                    |
| [concat](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#concatstring)([String...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                                | Returns a new String created by concatenating the string arguments together.                                                                                                   |
| [endsWith](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#endswithstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                               | Tests if this string ends with a given string.                                                                                                                                 |
| [endsWith](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#endswithstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                    | Tests if this string ends with a given string.                                                                                                                                 |
| [equals](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#equalsobject)([Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))                                                                                                                                                                                                   | Returns true if this string is equal to the string representation of the  passed objects.                                                                                      |
| [equalsIgnoreCase](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#equalsignorecaseobject)([Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md))                                                                                                                                                                               | Returns true if this string is equal to the string representation of the  passed objects.                                                                                      |
| static [fromCharCode](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#fromcharcodenumber)([Number...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                             | Returns a new String from one or more UTF-16 code units.                                                                                                                       |
| static [fromCodePoint](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#fromcodepointnumber)([Number...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                           | Returns a new String from one or more characters with Unicode code points.                                                                                                     |
| [includes](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#includesstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                               | Returns if *substring* is contained in this String object.                                                                                                                     |
| [includes](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#includesstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                    | Returns if *substring* is contained in this String object.                                                                                                                     |
| [indexOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#indexofstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                                 | Returns the index of *substring* in this String object.                                                                                                                        |
| [indexOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#indexofstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                      | Returns the index of *substring* in this String object using  the specified *start* value as the location to begin searching.                                                  |
| [lastIndexOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#lastindexofstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                         | Returns the last index of *substring* in this String object.                                                                                                                   |
| [lastIndexOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#lastindexofstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                              | Returns the last index of *substring* in this String object,  using the specified *start* position as the location from which  to begin the search.                            |
| [localeCompare](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#localecomparestring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                     | Returns a number indicating whether the current String sorts before, the same as,  or after the parameter *other*, based on browser and system-dependent  string localization. |
| [match](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#matchregexp)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md))                                                                                                                                                                                                     | Returns an array of strings that match the regular expression  *regexp*.                                                                                                       |
| [normalize](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalize)()                                                                                                                                                                                                                                                                                     | Returns the normalized form of this Unicode string.                                                                                                                            |
| [normalize](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalizestring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                             | Returns the normalized form of this Unicode string according to the standard as described in <https://unicode.org/reports/tr15/>.                                              |
| [padEnd](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padendnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                                   | Appends space characters to the current string to ensure the resulting string reaches the given target length.                                                                 |
| [padEnd](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padendnumber-string)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                        | Appends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.                                               |
| [padStart](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padstartnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                               | Prepends space characters to the current string to ensure the resulting string reaches the given target length.                                                                |
| [padStart](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#padstartnumber-string)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                    | Prepends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.                                              |
| static [raw](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#rawobject-string)([Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), [String...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                    | The static `String.raw()` method is a tag function of template literals.                                                                                                       |
| [repeat](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#repeatnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                                   | Returns a new string repeating this string the given number of times.                                                                                                          |
| [replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-function)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md))                                                                                                | Returns a new String that results when matches of the *regexp*  parameter are replaced by using the specified *function*.                                                      |
| [replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-string)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                      | Returns a new String that results when matches of the *regexp*  parameter are replaced by the *replacement* parameter.                                                         |
| [replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-function)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md))                                                                                                | Returns a new String that results when matches of the *literal*  parameter are replaced by using the specified *function*.                                                     |
| ~~[replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-function-string)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~ | Returns a new String that results when matches of the *literal*  parameter are replaced by using the specified *function*.                                                     |
| [replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-string)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                      | Returns a new String that results when matches of the *literal*  parameter are replaced by the *replacement* parameter.                                                        |
| ~~[replace](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replacestring-string-string)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))~~       | Returns a new String that results when matches of the *literal*  parameter are replaced by the *replacement* parameter.                                                        |
| [search](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#searchregexp)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md))                                                                                                                                                                                                   | Searches for a match between the passed regular expression and this  string and returns the zero-based index of the match, or -1 if no match  is found.                        |
| [slice](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#slicenumber-number)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                          | Returns a substring of the current String where the  specified *start* and *end* locations are used  to delimit the String.                                                    |
| [split](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitregexp)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md))                                                                                                                                                                                                     | Returns an array of String instances created by splitting the current  String based on the regular expression.                                                                 |
| [split](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitregexp-number)([RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                          | Returns an array of String instances created by splitting the current  String based on the regular expression and limited in size by the *limit*  parameter.                   |
| [split](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                                     | Returns an array of String instances created by splitting the current  String based on the delimiter.                                                                          |
| [split](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#splitstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                          | Returns an array of String instances created by splitting the current  String based on the delimiter and limited in size by the *limit*  parameter.                            |
| [startsWith](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#startswithstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                                                                                                           | Tests if this string starts with a given string.                                                                                                                               |
| [startsWith](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#startswithstring-number)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                | Tests if this string starts with a given string.                                                                                                                               |
| [substr](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substrnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                                   | Creates and returns a new String by splitting the current string  at the specified *start* location until the end of the String.                                               |
| [substr](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substrnumber-number)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                        | Creates and returns a new String by splitting the current string  at the specified *start* location and limited by the *length*  value.                                        |
| [substring](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substringnumber)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                                                                                                             | Creates and returns a new String by splitting the current string  at the specified *from* location until the end of the String.                                                |
| [substring](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#substringnumber-number)([Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))                                                                                                  | Creates and returns a new String by splitting the current string  at the specified *from* location until the specified *to* location.                                          |
| [toLocaleLowerCase](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolocalelowercase)()                                                                                                                                                                                                                                                                     | Returns a copy of the current string in all lower-case letters.                                                                                                                |
| [toLocaleUpperCase](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolocaleuppercase)()                                                                                                                                                                                                                                                                     | Returns a copy of the current string in all upper-case letters.                                                                                                                |
| [toLowerCase](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tolowercase)()                                                                                                                                                                                                                                                                                 | Returns a copy of the current string in all lower-case letters.                                                                                                                |
| [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#tostring)()                                                                                                                                                                                                                                                                                       | Returns a String value of this object.                                                                                                                                         |
| [toUpperCase](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#touppercase)()                                                                                                                                                                                                                                                                                 | Returns a copy of the current string in all upper-case letters.                                                                                                                |
| [trim](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trim)()                                                                                                                                                                                                                                                                                               | Removes white space characters at the start and the end of the string.                                                                                                         |
| [trimEnd](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimend)()                                                                                                                                                                                                                                                                                         | Removes white space characters at the end of the string.                                                                                                                       |
| [trimLeft](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimleft)()                                                                                                                                                                                                                                                                                       | Removes white space characters at the start of the string.                                                                                                                     |
| [trimRight](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimright)()                                                                                                                                                                                                                                                                                     | Removes white space characters at the end of the string.                                                                                                                       |
| [trimStart](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimstart)()                                                                                                                                                                                                                                                                                     | Removes white space characters at the start of the string.                                                                                                                     |
| [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#valueof)()                                                                                                                                                                                                                                                                                         | Returns a String value of this object.                                                                                                                                         |

### Methods inherited from class Object

[assign](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)

## Property Details

### length

- length: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : The length of the String object.

***

## Constructor Details

### String()

- String()
  - : Constructs the String.

***

### String(Number)

- String(num: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md))
  - : Constructs the String from the specified
    Number object.

    **Parameters:**

    - num - the number that will  be converted to a String.

***

### String(String)

- String(str: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))
  - : Constructs a new String from the specified
    String object.

    **Parameters:**

    - str - the String that will  be converted to a new String.

***

## Method Details

### charAt(Number)

- charAt(index: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a string containing the character at position *index*.
    You should use this method instead
    of substring when you need only a single character.

    **Parameters:**

    - index - the index at which the character string is located.

    **Returns:**

    - a string containing the character at position *index*.

***

### charCodeAt(Number)

- charCodeAt(index: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the UTF-16 code unit at the given position index. If the position is invalid `NaN` is returned.

    **Parameters:**

    - index - The index of the code unit within the string.

    **Returns:**

    - a non-negative integer representing a UTF-16 code unit or `NaN` if the index is not valid.

***

### codePointAt(Number)

- codePointAt(index: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the Unicode code point at the given position index. The index is a position within the string in UTF-16
    encoding. If the index points to the begin of a surrogate pair the only the code unit at the position is returned.
    If the index is invalid `undefined` is returned.

    **Parameters:**

    - index - The index of the starting code unit within the string.

    **Returns:**

    - The Unicode code point, an UTF-16 code unit or `undefined`.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### concat(String...)

- concat(strings: [String...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String created by concatenating the string arguments together.

    **Parameters:**

    - strings - zero, one, or more String arguments

    **Returns:**

    - a new String created by concatenating the string arguments together.

***

### endsWith(String)

- endsWith(searchString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Tests if this string ends with a given string.

    **Parameters:**

    - searchString - The characters to be searched for this string.

    **Returns:**

    - `true` if the search string was found else `false`

    **API Version:**

:::note
Available from version 21.2.
:::

***

### endsWith(String, Number)

- endsWith(searchString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), length: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Tests if this string ends with a given string.

    **Parameters:**

    - searchString - The characters to be searched for this string.
    - length - Assumes this string has only this given length.

    **Returns:**

    - `true` if the search string was found else `false`

    **API Version:**

:::note
Available from version 21.2.
:::

***

### equals(Object)

- equals(obj: [Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns true if this string is equal to the string representation of the
    passed objects.

    **Parameters:**

    - obj - another object, typically another string

***

### equalsIgnoreCase(Object)

- equalsIgnoreCase(obj: [Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns true if this string is equal to the string representation of the
    passed objects. The comparison is done case insensitive.

    **Parameters:**

    - obj - another object, typically another string

***

### fromCharCode(Number...)

- static fromCharCode(c: [Number...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String from one or more UTF-16 code units.

    **Parameters:**

    - c - zero, one, or more UTF-16 code units.

***

### fromCodePoint(Number...)

- static fromCodePoint(c: [Number...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String from one or more characters with Unicode code points.

    **Parameters:**

    - c - zero, one, or more code points.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### includes(String)

- includes(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns if *substring* is contained in this String object.

    **Parameters:**

    - substring - the String to search for in this String.

    **Returns:**

    - `true` if *substring* occurs within the current string, else `false`.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### includes(String, Number)

- includes(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Returns if *substring* is contained in this String object.

    **Parameters:**

    - substring - the String to search for in this String.
    - start - the location in the String from which to begin the search.

    **Returns:**

    - `true` if *substring* occurs within the current string, else `false`.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### indexOf(String)

- indexOf(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the index of *substring* in this String object.
    If there is no match, *-1* is returned.

    **Parameters:**

    - substring - the String to search for in this String.

    **Returns:**

    - the index of *substring* or *-1*.

***

### indexOf(String, Number)

- indexOf(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the index of *substring* in this String object using
    the specified *start* value as the location to begin searching.
    If there is no match, *-1* is returned.

    **Parameters:**

    - substring - the String to search for in this String.
    - start - the location in the String from which to  begin the search.

    **Returns:**

    - the index of *substring* or *-1*.

***

### lastIndexOf(String)

- lastIndexOf(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the last index of *substring* in this String object.
    If there is no match, *-1* is returned.

    **Parameters:**

    - substring - the String to search for in this String.

    **Returns:**

    - the last index of *substring* or *-1*.

***

### lastIndexOf(String, Number)

- lastIndexOf(substring: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the last index of *substring* in this String object,
    using the specified *start* position as the location from which
    to begin the search.
    If there is no match, *-1* is returned.

    **Parameters:**

    - substring - the String to search for in this String.
    - start - the location from which to begin the search.

    **Returns:**

    - the last index of *substring* or *-1*.

***

### localeCompare(String)

- localeCompare(other: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns a number indicating whether the current String sorts before, the same as,
    or after the parameter *other*, based on browser and system-dependent
    string localization.

    **Parameters:**

    - other - the String to compare against this String.

    **Returns:**

    - a number indicating whether the current String sorts before, the same as,
      or after the parameter *other*.

***

### match(RegExp)

- match(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [String\[\]](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns an array of strings that match the regular expression
    *regexp*.

    **Parameters:**

    - regexp - the regular expression to use.

    **Returns:**

    - an array of strings that match the regular expression.

***

### normalize()

- normalize(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the normalized form of this Unicode string. Same as calling [normalize(String)](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#normalizestring) with parameter **'NFC'**.

    **Returns:**

    - The normalized form of this Unicode string.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### normalize(String)

- normalize(form: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the normalized form of this Unicode string according to the standard as described in <https://unicode.org/reports/tr15/>.
    In a normalized string, identical text is replaced by identical sequences of code points.

    **Parameters:**

    - form - The normalization variant to use. Must be one of **'NFC'**, **'NFD'**, **'NFKC'**, **'NFKD'**.

    **Returns:**

    - The normalized form of this Unicode string.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### padEnd(Number)

- padEnd(targetLength: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Appends space characters to the current string to ensure the resulting string reaches the given target length.

    **Parameters:**

    - targetLength - The length to be reached.

    **Returns:**

    - This string if the string length is already greater than or equal to the target length. Else a new string with the *targetLength* ending with space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### padEnd(Number, String)

- padEnd(targetLength: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), fillString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Appends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.

    **Parameters:**

    - targetLength - The length to be reached.
    - fillString - The string providing the characters to be used for filling.

    **Returns:**

    - This string if the string length is already greater than or equal to the target length. Else a new string with the *targetLength* with the (possibly multiple times) added and truncated *fillString*.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### padStart(Number)

- padStart(targetLength: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Prepends space characters to the current string to ensure the resulting string reaches the given target length.

    **Parameters:**

    - targetLength - The length to be reached.

    **Returns:**

    - This string if the string length is already greater than or equal to the target length. Else a new string with the *targetLength* starting with space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### padStart(Number, String)

- padStart(targetLength: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), fillString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Prepends a string (possibly multiple times) to the current string to ensure the resulting string reaches the given target length.

    **Parameters:**

    - targetLength - The length to be reached.
    - fillString - The string providing the characters to be used for filling.

    **Returns:**

    - This string if the string length is already greater than or equal to the target length. Else a new string with the *targetLength* with the (possibly multiple times) added and truncated *fillString*.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### raw(Object, String...)

- static raw(callSite: [Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md), substitutions: [String...](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : The static `String.raw()` method is a tag function of template literals.

    It can be used in different ways:

    ```
    String.raw`Hello\n${40+2}!`;
    // returns: Hello\n42!
    // \ is here not an escape character like in string literals

    String.raw({ raw: ['a', 'b', 'c'] }, '-', '.' );
    // returns: a-b.c
    ```

    **Parameters:**

    - callSite - A well-formed template call site object, like `{ raw: ['a', 'b', 'c'] }`.
    - substitutions - The substitution values.

    **Returns:**

    - A string constructed by the template with filled substitutions.

    **API Version:**

:::note
Available from version 22.7.
:::

***

### repeat(Number)

- repeat(count: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new string repeating this string the given number of times.

    **Parameters:**

    - count - The number of times this string should be repeated. Must be non-negative.

    **Returns:**

    - A new string repeating this string the given number of times.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### replace(RegExp, Function)

- replace(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), function: [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String that results when matches of the *regexp*
    parameter are replaced by using the specified *function*. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. When you specify a function as the
    second parameter, the function is invoked after the match has been performed.

    **Parameters:**

    - regexp - the regular expression to use.
    - function - a Function that operates on matches of  *regexp* in the current String.

    **Returns:**

    - a new String that results when matches of the *regexp*
      parameter are replaced by the *function*.

***

### replace(RegExp, String)

- replace(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), replacement: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String that results when matches of the *regexp*
    parameter are replaced by the *replacement* parameter. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. If regexp has the global flag set,
    all occurrences are replaced, if the global flag is not set only the
    first occurrence is replaced.

    **Parameters:**

    - regexp - the regular expression to use.
    - replacement - a String that is to take the place of all matches of  *regexp* in the current String.

    **Returns:**

    - a new String that results when matches of the *regexp*
      parameter are replaced by the *replacement*.

***

### replace(String, Function)

- replace(literal: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), function: [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String that results when matches of the *literal*
    parameter are replaced by using the specified *function*. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. When you specify a function as the
    second parameter, the function is invoked after the match has been
    performed.

    **Parameters:**

    - literal - the literal string to locate.
    - function - a Function that operates on the match of  *literal* in the current String.

    **Returns:**

    - a new String that results when the first match of the *literal*
      parameter is replaced by the specified *function*.

***

### replace(String, Function, String)

- ~~replace(literal: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), function: [Function](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Function.md), flags: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
  - : Returns a new String that results when matches of the *literal*
    parameter are replaced by using the specified *function*. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. When you specify a function as the
    second parameter, the function is invoked after the match has been
    performed.

    **Parameters:**

    - literal - the literal string to locate.
    - function - a Function that operates on the match of  *literal* in the current String.
    - flags - a String containing any combination of the Regular  Expression flags of g - global match, i - ignore case, m - match over  multiple lines.

    **Returns:**

    - a new String that results when the first match of the *literal*
      parameter is replaced by the specified *function*.

    **Deprecated:**

:::warning
Use [replace(RegExp, Function)](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-function) instead.
:::

```
**API Version:**
```

:::note
No longer available as of version 21.2.
:::

***

### replace(String, String)

- replace(literal: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), replacement: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a new String that results when matches of the *literal*
    parameter are replaced by the *replacement* parameter. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. This method only replaces the first
    occurrence of the literal. To replace all occurrences see the polymorphic
    method with a regular expression as argument.

    **Parameters:**

    - literal - the literal string to locate.
    - replacement - a String that is to take the place of all matches of  *regexp* in the current String.

    **Returns:**

    - a new String that results when the first match of the *literal*
      parameter is replaced by the *replacement* parameter.

***

### replace(String, String, String)

- ~~replace(literal: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), replacement: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), flags: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
  - : Returns a new String that results when matches of the *literal*
    parameter are replaced by the *replacement* parameter. The
    original String is not modified so you must capture the new String
    in a variable to preserve changes. This method only replaces the first
    occurrence of the literal. To replace all occurrences see the polymorphic
    method with a regular expression as argument. Note that if flags

    **Parameters:**

    - literal - the literal string to locate.
    - replacement - a String that is to take the place of all matches of  *regexp* in the current String.
    - flags - a String containing any combination of the Regular  Expression flags of g - global match, i - ignore case, m - match over  multiple lines.

    **Returns:**

    - a new String that results when the first match of the *literal*
      parameter is replaced by the *replacement* parameter.

    **Deprecated:**

:::warning
Use [replace(RegExp, String)](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#replaceregexp-string) instead.
:::

```
**API Version:**
```

:::note
No longer available as of version 21.2.
:::

***

### search(RegExp)

- search(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Searches for a match between the passed regular expression and this
    string and returns the zero-based index of the match, or -1 if no match
    is found.

    **Parameters:**

    - regexp - the regular expression to use.

    **Returns:**

    - the zero-based indexed value of the first character in the
      current string that matches the pattern of the regular expression
      *regexp*, or -1 if no match is found.

***

### slice(Number, Number)

- slice(start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), end: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a substring of the current String where the
    specified *start* and *end* locations are used
    to delimit the String.

    **Parameters:**

    - start - the start position in the current  String from which the slice will begin.
    - end - the end position in the current  String from which the slice will terminate.

    **Returns:**

    - the String between the *start* and *end* positions.

***

### split(RegExp)

- split(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md)): [String\[\]](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns an array of String instances created by splitting the current
    String based on the regular expression.

    **Parameters:**

    - regexp - the regular expression to use to split the string.

    **Returns:**

    - an array of String instances created by splitting the current
      String based on the regular expression.

***

### split(RegExp, Number)

- split(regexp: [RegExp](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.RegExp.md), limit: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String\[\]](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns an array of String instances created by splitting the current
    String based on the regular expression and limited in size by the *limit*
    parameter.

    **Parameters:**

    - regexp - the regular expression to use to split the string.
    - limit - controls the maximum number of items that will  be returned.

    **Returns:**

    - an array of String instances created by splitting the current
      String based on the regular expression and limited in size by the *limit*
      parameter.

***

### split(String)

- split(delimiter: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [String\[\]](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns an array of String instances created by splitting the current
    String based on the delimiter.

    **Parameters:**

    - delimiter - the delimiter to use to split the string.

    **Returns:**

    - an array of String instances created by splitting the current
      String based on the delimiter.

***

### split(String, Number)

- split(delimiter: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), limit: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String\[\]](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns an array of String instances created by splitting the current
    String based on the delimiter and limited in size by the *limit*
    parameter.

    **Parameters:**

    - delimiter - the delimiter to use to split the string.
    - limit - controls the maximum number of items that will  be returned.

    **Returns:**

    - an array of String instances created by splitting the current
      String based on the delimiter and limited in size by the *limit*
      parameter.

***

### startsWith(String)

- startsWith(searchString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Tests if this string starts with a given string.

    **Parameters:**

    - searchString - The characters to be searched for this string.

    **Returns:**

    - `true` if the search string was found else `false`

    **API Version:**

:::note
Available from version 21.2.
:::

***

### startsWith(String, Number)

- startsWith(searchString: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md), position: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : Tests if this string starts with a given string.

    **Parameters:**

    - searchString - The characters to be searched for this string.
    - position - The position in this string at which to begin searching for searchString.

    **Returns:**

    - `true` if the search string was found else `false`

    **API Version:**

:::note
Available from version 21.2.
:::

***

### substr(Number)

- substr(start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Creates and returns a new String by splitting the current string
    at the specified *start* location until the end of the String.

    **Parameters:**

    - start - the start position in the current string from which  the new string will be created.

    **Returns:**

    - a new String created by splitting the current string
      starting at the specified *start* location until the end of the String.

***

### substr(Number, Number)

- substr(start: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), length: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Creates and returns a new String by splitting the current string
    at the specified *start* location and limited by the *length*
    value.

    **Parameters:**

    - start - the start position in the current string from which  the new string will be created.
    - length - controls the length of the new string.

    **Returns:**

    - a new String created by splitting the current string
      starting at the specified *start* location and limited by the *length*
      value.

***

### substring(Number)

- substring(from: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Creates and returns a new String by splitting the current string
    at the specified *from* location until the end of the String.

    **Parameters:**

    - from - the start position in the current string from which  the new string will be created.

    **Returns:**

    - a new String created by splitting the current string
      starting at the specified *from* location until the end of the String.

***

### substring(Number, Number)

- substring(from: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md), to: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Creates and returns a new String by splitting the current string
    at the specified *from* location until the specified *to* location.

    **Parameters:**

    - from - the start position in the current string from which  the new string will be created.
    - to - the end position in the current string from which the  new string will be created.

    **Returns:**

    - a new String created by splitting the current string
      starting at the specified *from* location until the specified
      *to* location.
      value.

***

### toLocaleLowerCase()

- toLocaleLowerCase(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a copy of the current string in all lower-case letters.

    **Returns:**

    - a copy of the current string in all lower-case letters.

***

### toLocaleUpperCase()

- toLocaleUpperCase(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a copy of the current string in all upper-case letters.

    **Returns:**

    - a copy of the current string in all upper-case letters.

***

### toLowerCase()

- toLowerCase(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a copy of the current string in all lower-case letters.

    **Returns:**

    - a copy of the current string in all lower-case letters.

***

### toString()

- toString(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a String value of this object.

    **Returns:**

    - a String value of this object.

***

### toUpperCase()

- toUpperCase(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a copy of the current string in all upper-case letters.

    **Returns:**

    - a copy of the current string in all upper-case letters.

***

### trim()

- trim(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Removes white space characters at the start and the end of the string.

    **Returns:**

    - A new string without leading and ending white space characters.

***

### trimEnd()

- trimEnd(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Removes white space characters at the end of the string.

    **Returns:**

    - A new string without ending white space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### trimLeft()

- trimLeft(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Removes white space characters at the start of the string.
    [trimStart()](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimstart) should be used instead of this.

    **Returns:**

    - A new string without leading white space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### trimRight()

- trimRight(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Removes white space characters at the end of the string.
    [trimEnd()](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md#trimend) should be used instead of this.

    **Returns:**

    - A new string without ending white space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### trimStart()

- trimStart(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Removes white space characters at the start of the string.

    **Returns:**

    - A new string without leading white space characters.

    **API Version:**

:::note
Available from version 21.2.
:::

***

### valueOf()

- valueOf(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns a String value of this object.

    **Returns:**

    - a String value of this object.

***
