---
schema_version: "1"
id: 9ede11a09c078dc675a7f1535a61d762c9c41ca2f3870a4d7e6d988ec1c166be
title: Perform String Manipulations
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/guides/get-started-dc-sql/query-string-manipulations.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-string-manipulations.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a843fe02c44ba32d42704f915a67c570a24c7bf462fa42183dc81d05b8ecbb1a
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# Perform String Manipulations

To modify the string values that a query returns, such as when a query returns only part of a string, use string manipulation functions. For example, if the first-name field includes a middle name, such as `Edna Martha`, you want to return only the middle name, `Martha`.

To extract the portion of a string value after a starting position, use `substring(string, startPosition)`. The `startPosition` argument starts from 1. In the name `Edna Martha`, the position of the first letter in `Martha` is 6. The substring function in this query returns `Martha`.

```
SELECT substring("ssot__FirstName__c", 6)
FROM "UnifiedIndividual__dlm"

```

However, the position of the middle name isn’t always the same, depending on the length of the first name. A better way to get the position of the middle name is to call the `strpos()` function. Because the first name and middle name are always delimited by a space, you can use `strpos()` to get the position of the space. Then add 1 so the position references the start of the middle name. This query combines `strpos()` and `substring()` to return the middle name.

```
SELECT substring("ssot__FirstName__c",
       strpos("ssot__FirstName__c", ' ')+1)
FROM "UnifiedIndividual__dlm"

```
