Tabular IQ
Back to Function Index

STRPART()

Overview

STRPART() extracts a specific section from a string by dividing it into parts based on specified delimiter characters. If no delimiters are provided, the function uses spaces as the default separator. This function is useful for parsing structured strings, extracting specific parts of text, and handling delimited data.

Function Format

STRPART(string, section number [, list])

Return Value

STRPART() returns a character string

Examples


// Single character delimiter
STRPART("12/25/2002", 1, "/") = "12"
STRPART("12/25/2002", 2, "/") = "25"
STRPART("12/25/2002", 3, "/") = "2002"

// Default space delimiter
STRPART("APPLES AND ORANGES", 1) = "APPLES"
STRPART("APPLES AND ORANGES", 2) = "AND"
STRPART("APPLES AND ORANGES", 3) = "ORANGES"

// Multiple character delimiters
STRPART("APPLES, AND ORANGES", 1, "S, ") = "APPLE"
STRPART("APPLES, AND ORANGES", 2, "S, ") = "AND"
STRPART("APPLES, AND ORANGES", 3, "S, ") = "ORANGE"

// Additional examples
STRPART("A:B:C:D", 2, ":") = "B"           // Simple delimiter
STRPART("First|Second|Third", 3, "|") = "Third"  // Pipe delimiter
STRPART("Part1-Part2-Part3", 1, "-") = "Part1"   // Hyphen delimiter

Notes

  • Important behaviors:
    • Uses space as default delimiter if none specified
    • Section numbers start at 1
    • Returns empty string for invalid section numbers
    • Handles multiple delimiter characters
    • Preserves original string case
  • Common use cases include:
    • Parsing delimited data
    • Extracting date components
    • Processing structured text
    • Data cleaning
    • Text analysis
  • The function is useful for:
    • String parsing
    • Data extraction
    • Text processing
    • Format conversion
  • Delimiter handling:
    • Single character delimiters (e.g., "/", "|", "-")
    • Multiple character delimiters
    • Space as default delimiter
    • Case-sensitive matching

See Also