STRPOS

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the location of a substring within a string.

Syntax

strpos(<string>, <substring>)

Arguments

Required

  • <string>: The string to search.
  • <substring>: The substring to find.

Returns

Returns an integer representing the 1-based position, or 0 if not found.

Considerations

  • Same as position(substring in string) but with reversed argument order.

Examples

Find Substring

Locate a substring within a string.

SELECT strpos('high', 'ig') AS result;

Returns 2.

Related Documentation