---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/guide/query-string-manipulations.md
cuppy_section: docs
cuppy_doc: YYKK-4MCH
cuppy_doc_uuid: 3e6bf0ff-8dd3-401b-b5a8-539a9fd03234
cuppy_permalink: https://cuppy.io/salesforce/d/YYKK-4MCH
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/guide/query-string-manipulations
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 9cebd417707075b1184c16965a34eea7fe1977ceb571dbad8bfe3828795d4232
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-string-manipulations.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## 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`.

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.


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
