---
schema_version: "1"
id: 1eb7706691a96b845ac98b6ca485f085cdfc0aa33b8d39bdc591dd13936be584
title: String Functions and Operators
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sql/guides/bi-sql-string-intro.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-intro.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2352369cf7c61153cea0853794c3ec1f81b97a42f3543b7876fd9b416929fc81
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# String Functions and Operators

SQL for CRM Analytics supports the following string functions and operators.

- **[ascii(char)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-ascii.md)**


    Returns UTF-8 numeric value of the specified character. Returns `null` if `{n}` is `null`.

- **[chr(int)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-chr.md)**


    Returns the UTF-8 character for integer `n`. Returns `null` if `{n}` is `null`.

- **[char_length(str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-char-length.md)**


    Returns the number of characters in a given string.

- **[ends_with(source_str, search_str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-ends-with.md)**


    Returns a Boolean indicating whether a string ends with the search string.

- **[index_of(source_str, search_str, [position,occurrence])](bi-sql-string-index-of.md)**


    Returns a boolean indicating whether a string ends with the search string.

- **[lower(str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-lower.md)**


    Returns a copy of string _str_ with all cased characters converted to lowercase.

- **[mv_to_string(multivalue_column_name, [delimeter])](bi-sql-string-mts.md)**


    Converts multivalue fields to string fields.

- **[position(search_str IN source_str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-position.md)**


    Returns an integer that indicates the first occurrence of a substring in a given string. If the substring is not found, the function returns 0.

- **[replace(str, old_str, new_str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-replace.md)**


    Replaces all occurrences in string _str_ of a substring _old_str_ with a new substring _new_str_. Returns a new string.

- **[starts_with(source_str, search_str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-starts-with.md)**


    Returns a Boolean indicating whether a string begins with the search string.

- **[substring(str FROM start FOR length)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-substring.md)**


    Returns a substring from string _str_ that begins with the character at the _start_ position.

- **[trim(LEADING | TRAILING | BOTH, chars, str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-trim.md)**


    Removes leading or trailing characters from a string. If no characters are specified, the function removes blank spaces.

- **[upper(str)](https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-upper.md)**


    Returns a copy of string _str_ with all cased characters converted to uppercase.
