Ask AI
Skip to main content

Strip

Function: Strip

This function helps you clean up text by removing a specific sequence of characters from both the beginning and the end of a larger piece of text. It's useful for getting rid of unwanted prefixes or suffixes, like extra spaces, special characters, or common labels, to standardize your data.

Input

  • Text: The main piece of text you want to clean. This is the text from which characters will be removed.
  • To strip: The specific sequence of characters you want to remove from the start and end of your main text.

Output

  • Result: The cleaned-up text after the specified characters have been removed. This text will be stored in a new variable, which will be named RESULT by default.

Execution Flow

Real-Life Examples

Example 1: Cleaning up a product code Imagine you have product codes that sometimes come with "PROD-" at the beginning and "-END" at the end, and you only want the core code.

  • Inputs:
    • Text: "PROD-ABC123XYZ-END"
    • To strip: "PROD--END"
  • Result: A new variable named RESULT will be created, containing "ABC123XYZ".

Example 2: Removing leading/trailing spaces from user input When users enter data, they often add extra spaces. You want to ensure a clean name without unnecessary whitespace.

  • Inputs:
    • Text: " John Doe "
    • To strip: " " (a single space character)
  • Result: A new variable named RESULT will be created, containing "John Doe".

Example 3: Standardizing file names You have file names that might have "FILE_" at the start and ".txt" at the end, and you want to extract just the unique identifier.

  • Inputs:
    • Text: "FILE_Report_Q3_2023.txt"
    • To strip: "FILE_.txt"
  • Result: A new variable named RESULT will be created, containing "Report_Q3_2023".